pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ragnar <gnari@hive.is>
To: Anthony Ransley <anthonyr@aurema.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Split select completes, single select doesn't and
Date: Tue, 30 May 2006 21:53:20 +0000
Message-ID: <1149026000.8566.119.camel@localhost.localdomain> (raw)
In-Reply-To: <447B9143.6010407@aurema.com>
References: <447B9143.6010407@aurema.com>

On þri, 2006-05-30 at 10:26 +1000, Anthony Ransley wrote:
> Can any one explain why the following query
> 
> select f(q) from
> (
>     select * from times
>     where '2006-03-01 00:00:00'<=q and q<'2006-03-08 00:00:00'
>     order by q
> ) v;
> 
> never completes, but splitting up the time span into single days does work.
> 
> select f(q) from
> (
>     select * from times
>     where '2006-03-01 00:00:00'<=q and q<'2006-03-02 00:00:00'
>     order by q
> ) v;

first question: is f() relevant to your problem?

I mean do you see the same effect with:
  select q from
  (
    select * from times
    where '2006-03-01 00:00:00'<=q and q<'2006-03-08 00:00:00'
    order by q
  ) v;

or even:
  select q from times
     where '2006-03-01 00:00:00'<=q and q<'2006-03-08 00:00:00'
     order by q


if f() is needed to make this happen show us f()

if f() is not relevant, show us the simplest cases where
you see this. show us EXPLAIN on the query that does not
finish, show us EXPLAIN ANALYZE on the queries that do.

second question: what indexes exist on the table "times" ?

another question: how many rows in the table ?

next question: is the table newly ANALYZED?

finally: what version of postgresql are you using?


whithout more info , it is difficult to guess what
your problem is, but possibly you need to increase
the statistics target of column "q"

gnari






view thread (2+ messages)

Message-ID: <1149026000.8566.119.camel@localhost.localdomain>
Permalink:  ../1149026000.8566.119.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1149026000.8566.119.camel@localhost.localdomain

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: gnari@hive.is, anthonyr@aurema.com
  Subject: Re: Split select completes, single select doesn't and
  In-Reply-To: <1149026000.8566.119.camel@localhost.localdomain>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox