Re: Query response time - Mailing list pgsql-sql

From Jonathan Sinclair
Subject Re: Query response time
Date
Msg-id 746457F7E51F3B4BB53A8447D7204B78E463@MVGMAIL.mvg.local
Whole thread Raw
In response to Query response time  ("Jonathan Sinclair" <jonathan.sinclair@molevalleyfarmers.com>)
Responses Re: Query response time  (Scott Marlowe <smarlowe@g2switchworks.com>)
List pgsql-sql
Hi all. Thanks for your help so far. However after configuring my system
I am still getting major lag times with a couple of queries. The first,
which suffers from the '538/539'(see old email included below) bug, is
caused by running the following statement:

SELECT t1.col1, SUM(test) test_col, SUM(col2)
FROM table1 tl, table2 t2
WHERE t1.date BETWEEN '01/10/2004' AND '01/10/2004'
AND t1.col3 = t2.col1
AND t1.col5 = t2.col2
AND t2.col3 BETWEEN 50.00 AND 200.00
GROUP BY t1.col1
HAVING SUM(test) BETWEEN 95.00 AND 100.00
ORDER BY 2 DESC, t1.col1;

I would like to know if anyone has any ideas why this problem arises.
(It's not due to the date format being ambiguous; I have set it to
European standard)

A second statement I have prepared has the same problem but this time
works fine with a limit of 2 but breaks as soon as I set the limit to 3.
The offending statement is:

SELECT t1.col1, t1.col2, t2.col2, t3.col2
FROM table1 t1, table2 t2, table3 t3,
WHERE t1.date BETWEEN '01/10/2004' AND '01/10/2004'
AND t3.date = t1.date + 365
AND t2.date = t1.date + 14
AND t1.col1 = t2.col1
AND t1.col1 = t3.col1
And t1.col1 <> ''
AND t2.col2 < t1.col2;

Both queries work for limited limit sets. But break at different points
i.e. enter infinite loops?
Does anyone have any ideas? Both queries process fine in Informix!

I have run vacuum analyze and full commands on both tables! This didn't
solve the problem.

Regards,

Jonathan

-----Original Message-----

Hi all,

I am using PostgresSQL 7.4 and having some serious performance issues.
Trawling through the archives and previous posts the only visible advice
I could see was either by running vacuum or setting the fsynch flag to
false.


I am using tables that only contain approx 2GB of data. However
performing a number of simple conditional select statements takes a
great deal of time. Putting limits on the data obviously reduces the
time, but there is still a delay. (Note: on one particular query I set
the limit to 538 and the query returns in under 2mins if the limit
becomes 539 the query loops indefinitely!)

From previous experience I know these delays are longer than both
Informix and MySql. In some instances it takes so long I end up having
to kill the query.


The install was performed by yum onto a RAID server using Centos. I am
sure there is something fundamentally wrong for I can't believe that
postgres would have the reputation it has based on the statistics I'm
getting. Does anyone have any advice?


The data I am using was imported from an Informix system as part of a
migration strategy.

I know this is long shot but I hope someone can shed some light.

Regards,

Jonathan


This email may contain information which is privileged or confidential. This information is intended only for the named
recipient.If you are not the intended recipient, please be aware that disclosure, copying, distribution or use of this
informationis prohibited. If you have received this email in error, we would be grateful if you would inform us as soon
aspossible by telephoning +44 (0) 1769 573431, or by email to admin@molevalleyfarmers.com and then delete this email.
Viewsor opinions expressed in this email are those of the writer, and are not necessarily the views of Mole Valley
FarmersLimited or its subsidiary companies. Unless specifically stated, this email does not constitute any part of an
offeror contract.
 


pgsql-sql by date:

Previous
From: Christopher Browne
Date:
Subject: Re: sql error creating function
Next
From: "Chris Lukenbill"
Date:
Subject: Can't find which return type is incorrect.