If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Pervasive.SQL > Problem with Query Optimizer

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-15-03, 11:19
AJV AJV is offline
Registered User
 
Join Date: Feb 2003
Posts: 9
Question Problem with Query Optimizer

We face the following problem.
We use under Pervasive 2000 (SP 4) the following query (running in PCC):

Select *
from Objects
where OBCreateDate >= '2002-07-15'
and OBCreateDate <= '2003-07-26'
and OBLastElabMType = 8900
and OBSeries >= 1
and OBSeries <= 9
and OBLastElabPlant = 1
and OBLastElabMID in (0, 1)
and OBState = 0
and OBStatus = 1
order by OBCreateDate, OBCreateTime, OBLastElabMType, OBSeries, OBObject, OBSubObject


where the 'order by'=
"OBCreateDate, OBCreateTime, OBLastElabMType, OBSeries, OBObject, OBSubObject" (KEY 3) is an index on table objects.

Using "Query Plan" tool of Pervasive we saw that Query Optimizer uses a different key in order to collect data.
Note that execution of the above sql statement takes over 5 minutes (objects table has more than 450.000 records), while the same statement
without the order by clause takes 1-2 seconds to be executed.


1. Why query optimizer doesn't use KEY 3 as we define in order by clause?
2. How it is possible to force Query Optimizer to use KEY 3 which is in order by clause?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On