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 > Slow queries

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-25-04, 07:09
Rawbat Rawbat is offline
Registered User
 
Join Date: Oct 2003
Location: Sweden
Posts: 45
Question Slow queries

Hi,
I'm experiencing awfully slow performance when executing queries using SQL Data Manager or through ODBC.
I have tried directly on the server but with no noticeable improvement.

The query joins a couple of tables with group by and some summing, and I never even get a hint that the query is even executing, it's that slow!
Also I wonder why it doesn't even start to exploit the server's resources, it barely uses a few percent CPU and merely some 700MB memory (out of 2GB).
I did read about some limitations in memory handling in the 200i, but what about CPU?

When I import the tables to MS SQL Server (which I'm more used to using) I get the result in seconds without indexing.
With another query I cannot do this though, as it aborts the import after running for some 8 hours or so. I noticed it copying only a few hundred rows/second.

Is there some special relational engine or something I have to activate?
Does it require indexes to run joins?

Example of query I try to run (somewhat simplified):
Code:
SELECT O.OrderId, O.Row, SUM(O.Cost), SUM(T.Cost)
FROM OrderRow O INNER JOIN Transaction T 
        ON O.OrderId = T.OrderId AND O.Row = T.Row
WHERE O.OrderDate >= '20040401'
GROUP BY O.OrderId, O.Row
HAVING SUM(O.Cost) <> SUM(T.Cost)
Thanks for any help!

Cheers,
Robert
Reply With Quote
  #2 (permalink)  
Old 05-25-04, 07:45
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
First off, make sure you're using the latest Service Pack and Hot FIxes for the Pervasive engine.
Second, run a database consistency check (using the Check Database Wizard). Does it pass for the tables you're querying? If not, fix the DDFs or get new ones (if the data is from a third party application).
Third, use the Query Plan View (http://www.sys-con.com/tango/archives/0102/sneary/) to make sure the query is optimizing properly.
__________________
Mirtheil Software
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
Reply With Quote
  #3 (permalink)  
Old 05-27-04, 07:24
Rawbat Rawbat is offline
Registered User
 
Join Date: Oct 2003
Location: Sweden
Posts: 45
Thanks

It's SP4, which I believe is the latest for 2000i. I think all hotfixes are installed, but am not entirely sure.

The Check utility returns some errors:
Quote:
Index ACS Flag Inconsistency.
The dictionary index 0 seg 0 indicates Yes
Data file index 0 seg 0 indicates No
You got any idea what these means?
Recreating the DDFs from the 3rd party app does not amend this.

However, I have noticed that Pervasives query optimizer does not work well with ANSI joins, and it first joins all rows before filtering.
By using old fashioned joins performance is much better!
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