SQL Newbie needs urgently help! [optimizing query]
Posted by:
Toxic Head
Date: January 24, 2007 05:31AM
Hi all,
I've to optimize an Sql, which is called multiple times to create a tree of valid products.
I've tree Tables:
Products [more than 800.000 entries]
Categories [more than 80.000 entries]
Cat2ProdRel [more than 1.400.000 entries]
now I've to execute a query like this...
explain SELECT item_t0.PK
FROM Products item_t0
WHERE ( item_t0.PK IN ( {A big list of Product Keys} ))
AND (item_t0.TypePkString IN ( {a shorter List if Type Keys} )
AND (( item_t0.p_approvalstatus = { one state Key } )
AND (EXISTS
(SELECT item_t1.PK
FROM Categories item_t1 JOIN Cat2ProdRel item_t2
ON item_t1.PK = item_t2.SourcePK
WHERE ( item_t2.TargetPK = item_t0.PK )
AND ((item_t1.TypePkString IN ( { two type Keys } )
AND (( item_t1.p_catalogversion IN ( { short list of version keys } )))
AND item_t2.TypePkString = { one Type Key } ))))
AND (( item_t0.p_onlinedate IS NULL OR item_t0.p_onlinedate <= '2007-01-09 00:00:00.0' )
AND ( item_t0.p_offlinedate IS NULL OR item_t0.p_offlinedate >= '2007-01-09 00:00:00.0' ))) )
This statement will run 50 sek+ so the creation of the product tree will be very slow.
So my question for the sql professionals:
How can I speed up the query so that I get acceptable results?
I'm a absolutely newbie on sql and this tuning is very urgent.
Any help would be very appreciated.
Many ThanX in advance
Toxic
Subject
Views
Written By
Posted
SQL Newbie needs urgently help! [optimizing query]
3648
January 24, 2007 05:31AM
2399
January 24, 2007 05:52AM
2278
January 24, 2007 06:07AM
2340
January 24, 2007 06:18AM
2190
January 24, 2007 06:41AM
2241
January 24, 2007 07:16AM
2295
January 24, 2007 08:16AM
2384
January 24, 2007 08:50AM
2210
January 24, 2007 09:10AM
2371
January 24, 2007 09:24AM
2470
January 24, 2007 10:29AM
2316
January 24, 2007 10:40AM
2208
January 24, 2007 03:19PM
2162
January 25, 2007 07:27AM
2247
January 24, 2007 07:16AM
2359
January 24, 2007 07:32AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.