Performance problem with about 1 million records
744464Jan 5 2010 — edited Jan 11 2010Hello everybody.
I have performance problem.
I using Oracle 11g, Windows server 2003.
I have 3 tables:
1. my_documents -> About 850,000 records.
2. relat_documents_groups -> About 10 records.
3. relat_documents_projects -> About 850,000 records.
I'm executing this query:
select d.document_id from my_documents d
LEFT JOIN relat_documents_groups rdg
ON d.version_label = rdg.version_label
INNER JOIN relat_documents_projects rdp
ON d.document_id = rdp.document_id
order by document_id desc
It's takes 4 seconds until the data retrives.
But if i remove the "Order by" clause (last row) it's takes 0.3 seconds.
Why 'Order By' takes more than 3 seconds? How can i improve this?
I don't think i need to improve my query because the same query runs on MSSQL 2005 in less
than 1 second (on the same tables and rows).
I think it's something with the DataBase itself but i don't know what.
Is anybody know?
Thanks,
MTs.