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]
3549
January 24, 2007 05:31AM
2352
January 24, 2007 05:52AM
2254
January 24, 2007 06:07AM
2305
January 24, 2007 06:18AM
2169
January 24, 2007 06:41AM
2185
January 24, 2007 07:16AM
2264
January 24, 2007 08:16AM
2343
January 24, 2007 08:50AM
2189
January 24, 2007 09:10AM
2304
January 24, 2007 09:24AM
2429
January 24, 2007 10:29AM
2249
January 24, 2007 10:40AM
2187
January 24, 2007 03:19PM
2114
January 25, 2007 07:27AM
2164
January 24, 2007 07:16AM
2334
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.