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]
3953
January 24, 2007 05:31AM
2579
January 24, 2007 05:52AM
2435
January 24, 2007 06:07AM
2503
January 24, 2007 06:18AM
2376
January 24, 2007 06:41AM
2422
January 24, 2007 07:16AM
2505
January 24, 2007 08:16AM
2557
January 24, 2007 08:50AM
2385
January 24, 2007 09:10AM
2573
January 24, 2007 09:24AM
2708
January 24, 2007 10:29AM
2502
January 24, 2007 10:40AM
2402
January 24, 2007 03:19PM
2339
January 25, 2007 07:27AM
2430
January 24, 2007 07:16AM
2547
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.