Unix Technical Forum

Query time

This is a discussion on Query time within the Pgsql Performance forums, part of the PostgreSQL category; --> Hi, I think im specting problems with a 7.4.8 postgres database. Sometimes some big query takes between 5 to ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Performance

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 08:15 AM
Ruben Rubio Rey
 
Posts: n/a
Default Query time

Hi,

I think im specting problems with a 7.4.8 postgres database.

Sometimes some big query takes between 5 to 15 seconds. It happens
sometimes all the day it does not depend if database is busy.

I have measured that sentence in 15 - 70 ms in normal circunstances.

Why sometimes its takes too much time?
How can I fix it?
Is a postgres version problem, database problem or query problem?

Any ideas will be apreciatted.

Ruben Rubio



---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 08:15 AM
Michael Fuhr
 
Posts: n/a
Default Re: Query time

On Fri, Mar 10, 2006 at 11:05:57AM +0100, Ruben Rubio Rey wrote:
> Sometimes some big query takes between 5 to 15 seconds. It happens
> sometimes all the day it does not depend if database is busy.
>
> I have measured that sentence in 15 - 70 ms in normal circunstances.


Is it the *exact* same query, including the values you're querying
for? The same query with different values can run with different
plans depending on row count estimates. It might be useful to see
the query string and the EXPLAIN ANALYZE output for a fast query
and a slow one.

How many tables are you querying? Might you be hitting geqo_threshold
(default 12)? If so then the following thread might be helpful:

http://archives.postgresql.org/pgsql...1/msg00132.php

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 08:15 AM
Ruben Rubio Rey
 
Posts: n/a
Default Re: Query time

Michael Fuhr wrote:

>On Fri, Mar 10, 2006 at 11:05:57AM +0100, Ruben Rubio Rey wrote:
>
>
>>Sometimes some big query takes between 5 to 15 seconds. It happens
>>sometimes all the day it does not depend if database is busy.
>>
>>I have measured that sentence in 15 - 70 ms in normal circunstances.
>>
>>

>
>Is it the *exact* same query, including the values you're querying
>for? The same query with different values can run with different
>plans depending on row count estimates. It might be useful to see
>the query string and the EXPLAIN ANALYZE output for a fast query
>and a slow one.
>
>How many tables are you querying? Might you be hitting geqo_threshold
>(default 12)? If so then the following thread might be helpful:
>
>http://archives.postgresql.org/pgsql...1/msg00132.php
>
>
>


The querys that are failing are very similar. But, when I see the
warning in logs files, I take that query and try it, and takes a few
miliseconds (as spected). That query one table on FROM and 2 or 3 on
WHERE clause.

Rigth now Im using the default server configuration for geqo_threshold,
but i'll ckeck the link that u provide me.

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-19-2008, 08:15 AM
Richard Huxton
 
Posts: n/a
Default Re: Query time

Ruben Rubio Rey wrote:
> Hi,
>
> I think im specting problems with a 7.4.8 postgres database.
>
> Sometimes some big query takes between 5 to 15 seconds. It happens
> sometimes all the day it does not depend if database is busy.
>
> I have measured that sentence in 15 - 70 ms in normal circunstances.
>
> Why sometimes its takes too much time?
> How can I fix it?
> Is a postgres version problem, database problem or query problem?


Information, Ruben - we can't do anything without information.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-19-2008, 08:16 AM
Ruben Rubio Rey
 
Posts: n/a
Default Re: Query time

Richard Huxton wrote:

> Ruben Rubio Rey wrote:
>
>> Hi,
>>
>> I think im specting problems with a 7.4.8 postgres database.
>>
>> Sometimes some big query takes between 5 to 15 seconds. It happens
>> sometimes all the day it does not depend if database is busy.
>>
>> I have measured that sentence in 15 - 70 ms in normal circunstances.
>>
>> Why sometimes its takes too much time?
>> How can I fix it?
>> Is a postgres version problem, database problem or query problem?

>
>
> Information, Ruben - we can't do anything without information.
>

What usefull information could I provide?


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-19-2008, 08:16 AM
PFC
 
Posts: n/a
Default Re: Query time



>> Information, Ruben - we can't do anything without information.
>>

> What usefull information could I provide?


Offending queries, EXPLAIN ANALYZE, tables description, condiguration
parameters, hardware, intended use...

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-19-2008, 08:16 AM
Nick Howden
 
Posts: n/a
Default unsubscribe

unsubscribe


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:54 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com