Simple sql using distinct and union too slow - Oracle Database
This is a discussion on Simple sql using distinct and union too slow - Oracle Database ; Here is a query select distinct fiscal_year, accounting_period from ps_ledger union select distinct fiscal_year, accounting_period from ps_ledger_kk union select distinct fiscal_year, accounting_period from ps_ledger_budg The tables have about 1 million rows each. Here is the explain plan Operation Object Name ...
| | LinkBack | Thread Tools | Display Modes |
|
#1
| |||
| |||
| select distinct fiscal_year, accounting_period from ps_ledger union select distinct fiscal_year, accounting_period from ps_ledger_kk union select distinct fiscal_year, accounting_period from ps_ledger_budg The tables have about 1 million rows each. Here is the explain plan Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop SELECT STATEMENT Optimizer Mode=ALL_ROWS 32 27811 SORT UNIQUE 32 253 27811 UNION-ALL INDEX FAST FULL SCAN SYSADM.PSFLEDGER 1 M 11 M 5598 INDEX FAST FULL SCAN SYSADM.PSALEDGER_KK 948 K 7 M 7389 INDEX FAST FULL SCAN SYSADM.PS_LEDGER_BUDG 363 K 2 M 3064 It takes about 5 secs. I want it to run in 1 sec or less. Any ideas? |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | |
| |
All times are GMT -4. The time now is 08:27 AM.

Linear Mode