我想优化下表之间的连接,请指教。
其他问题:
哪个条件 将首先处理(优化者关注最佳加入)?
请告诉我一些如何优化的提示。
表行计数:
参见表索引:
COLUMN_NAME TABLE_NAME
ITEM_ID FM_MATL_DTL
LINE_TYPE FM_MATL_DTL
FORMULA_ID FM_MATL_DTL
FORMULALINE_ID FM_MATL_DTL
FORMULA_ID FM_MATL_DTL
LINE_TYPE FM_MATL_DTL
LINE_NO FM_MATL_DTL
ORGANIZATION_ID GME_BATCH_HEADER
BATCH_NO GME_BATCH_HEADER
BATCH_STATUS GME_BATCH_HEADER
BATCH_CLOSE_DATE GME_BATCH_HEADER
BATCH_ID GME_BATCH_HEADER
ORGANIZATION_ID GME_BATCH_HEADER
BATCH_NO GME_BATCH_HEADER
BATCH_TYPE GME_BATCH_HEADER
ORGANIZATION_ID GME_MATERIAL_DETAILS
INVENTORY_ITEM_ID GME_MATERIAL_DETAILS
LINE_TYPE GME_MATERIAL_DETAILS
BATCH_ID GME_MATERIAL_DETAILS
PHANTOM_ID GME_MATERIAL_DETAILS
MATERIAL_DETAIL_ID GME_MATERIAL_DETAILS
BATCH_ID GME_MATERIAL_DETAILS
LINE_NO GME_MATERIAL_DETAILS
LINE_TYPE GME_MATERIAL_DETAILS
INVENTORY_ITEM_ID MTL_MATERIAL_TRANSACTIONS
ORGANIZATION_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_DATE MTL_MATERIAL_TRANSACTIONS
COSTED_FLAG MTL_MATERIAL_TRANSACTIONS
TRANSACTION_GROUP_ID MTL_MATERIAL_TRANSACTIONS
PARENT_TRANSACTION_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_SET_ID MTL_MATERIAL_TRANSACTIONS
PM_COST_COLLECTED MTL_MATERIAL_TRANSACTIONS
PM_COST_COLLECTOR_GROUP_ID MTL_MATERIAL_TRANSACTIONS
COMPLETION_TRANSACTION_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_ACTION_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_TYPE_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_SOURCE_TYPE_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_DATE MTL_MATERIAL_TRANSACTIONS
PICK_SLIP_NUMBER MTL_MATERIAL_TRANSACTIONS
MOVE_ORDER_LINE_ID MTL_MATERIAL_TRANSACTIONS
PICKING_LINE_ID MTL_MATERIAL_TRANSACTIONS
RCV_TRANSACTION_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_SOURCE_ID MTL_MATERIAL_TRANSACTIONS
ORGANIZATION_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_DATE MTL_MATERIAL_TRANSACTIONS
PROJECT_ID MTL_MATERIAL_TRANSACTIONS
TO_PROJECT_ID MTL_MATERIAL_TRANSACTIONS
SOURCE_PROJECT_ID MTL_MATERIAL_TRANSACTIONS
TRANSFER_TRANSACTION_ID MTL_MATERIAL_TRANSACTIONS
INVOICED_FLAG MTL_MATERIAL_TRANSACTIONS
TRANSACTION_SOURCE_TYPE_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_ACTION_ID MTL_MATERIAL_TRANSACTIONS
OPM_COSTED_FLAG MTL_MATERIAL_TRANSACTIONS
TRANSACTION_EXTRACTED MTL_MATERIAL_TRANSACTIONS
TRX_SOURCE_LINE_ID MTL_MATERIAL_TRANSACTIONS
XML_DOCUMENT_ID MTL_MATERIAL_TRANSACTIONS
SUBINVENTORY_CODE MTL_MATERIAL_TRANSACTIONS
ORGANIZATION_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_DATE MTL_MATERIAL_TRANSACTIONS
VENDOR_LOT_NUMBER MTL_MATERIAL_TRANSACTIONS
TRANSACTION_DATE MTL_MATERIAL_TRANSACTIONS
ORGANIZATION_ID MTL_MATERIAL_TRANSACTIONS
SHIPMENT_NUMBER MTL_MATERIAL_TRANSACTIONS
ACCT_PERIOD_ID MTL_MATERIAL_TRANSACTIONS
ORGANIZATION_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_SOURCE_TYPE_ID MTL_MATERIAL_TRANSACTIONS
ORGANIZATION_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_DATE MTL_MATERIAL_TRANSACTIONS
TRANSACTION_SOURCE_NAME MTL_MATERIAL_TRANSACTIONS
TRANSACTION_ACTION_ID MTL_MATERIAL_TRANSACTIONS
ORGANIZATION_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_TYPE_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_DATE MTL_MATERIAL_TRANSACTIONS
TRANSACTION_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_ACTION_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_TYPE_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_SOURCE_TYPE_ID MTL_MATERIAL_TRANSACTIONS
TRANSACTION_ID MTL_MATERIAL_TRANSACTIONS
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
SEGMENT1 MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
PLANNER_CODE MTL_SYSTEM_ITEMS_B
WEB_STATUS MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
CUSTOMER_ORDER_ENABLED_FLAG MTL_SYSTEM_ITEMS_B
SERVICE_ITEM_FLAG MTL_SYSTEM_ITEMS_B
VENDOR_WARRANTY_FLAG MTL_SYSTEM_ITEMS_B
USAGE_ITEM_FLAG MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
WIP_SUPPLY_LOCATOR_ID MTL_SYSTEM_ITEMS_B
BASE_ITEM_ID MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
STYLE_ITEM_ID MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
EAM_ITEM_TYPE MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
DESCRIPTION MTL_SYSTEM_ITEMS_B
INVENTORY_ITEM_STATUS_CODE MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
AUTO_CREATED_CONFIG_FLAG MTL_SYSTEM_ITEMS_B
WH_UPDATE_DATE MTL_SYSTEM_ITEMS_B
ITEM_CATALOG_GROUP_ID MTL_SYSTEM_ITEMS_B
CATALOG_STATUS_FLAG MTL_SYSTEM_ITEMS_B
PRODUCT_FAMILY_ITEM_ID MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
COMMS_NL_TRACKABLE_FLAG MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
BUYER_ID MTL_SYSTEM_ITEMS_B
INVENTORY_ITEM_ID MTL_SYSTEM_ITEMS_B
ORGANIZATION_ID MTL_SYSTEM_ITEMS_B
TRANSACTION_ID MTL_TRANSACTION_LOT_NUMBERS
ORGANIZATION_ID MTL_TRANSACTION_LOT_NUMBERS
TRANSACTION_DATE MTL_TRANSACTION_LOT_NUMBERS
LOT_NUMBER MTL_TRANSACTION_LOT_NUMBERS
INVENTORY_ITEM_ID MTL_TRANSACTION_LOT_NUMBERS
ORGANIZATION_ID MTL_TRANSACTION_LOT_NUMBERS
TRANSACTION_SOURCE_ID MTL_TRANSACTION_LOT_NUMBERS
PRODUCT_CODE MTL_TRANSACTION_LOT_NUMBERS
PRODUCT_TRANSACTION_ID MTL_TRANSACTION_LOT_NUMBERS
SERIAL_TRANSACTION_ID MTL_TRANSACTION_LOT_NUMBERS
TRANSACTION_ID MTL_TRANSACTION_LOT_NUMBERS
ORGANIZATION_ID MTL_TRANSACTION_LOT_NUMBERS
我创建的查询:
SELECT
gbh.batch_no,
gbh.batch_id,
msi.segment1 as ITEM,
--msi.description,
lot.lot_number as LOT,
gmd.line_type,
msi.inventory_item_id
,fmd.attribute1 as SIGNIFICANT_ITEM
--,msi.inventory_item_id||lot.lot_number as THING_ID
FROM
gme.gme_batch_header gbh,
gme.gme_material_details gmd,
inv.mtl_material_transactions mmt,
inv.mtl_system_items_b msi,
inv.mtl_transaction_lot_numbers lot
,GMD.fm_matl_dtl fmd
WHERE 1=1
--AND gmd.line_type = -1
AND gbh.batch_id = gmd.batch_id
AND gbh.organization_id = 1509
AND gbh.formula_id = fmd.formula_id
AND msi.inventory_item_id = fmd.inventory_item_id
AND msi.organization_id = fmd.organization_id
AND gmd.organization_id = gbh.organization_id
AND gmd.organization_id = msi.organization_id
AND mmt.inventory_item_id = msi.inventory_item_id
AND mmt.trx_source_line_id = gmd.material_detail_id
AND mmt.transaction_source_id = gmd.batch_id
AND mmt.transaction_id = lot.transaction_id
AND lot.TRANSACTION_SOURCE_ID = gbh.Batch_Id
AND lot.organization_id = mmt.organization_id
AND lot.inventory_item_id = mmt.inventory_item_id