Re: slow query performance

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Dave Weaver <davew(at)wsieurope(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: slow query performance
Date: 2003-10-30 15:34:44
Message-ID: 20031030073136.B40726@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, 30 Oct 2003, Dave Weaver wrote:

> Jeff wrote:
> > Dave Weaver wrote:
> > > For instance:
> > > SELECT station, air_temp FROM obs
> > > WHERE station = 'EGBB'
> > > AND valid_time > '28/8/03 00:00'
> > > AND valid_time < '28/10/03 00:00'
> > >
> > > takes 4 mins 32 secs.
> >
> > How many rows should that return?
> > [explain analyze will tell you that]
>
> "explain analyze" doesn't seem to be part of this postgres version
> (or I misunderstood something).
> That particular query returned 24 rows.
>
>
> > and while that runs is your disk thrashing? vmstat's bi/bo columns will
> > tell you.
>
> The machine's over the other side of the building, so I can't physically
> see if the disk is thrashing.
> I'm not sure how to interpret the vmstat output; running "vmstat 1" shows
> me bi/bo both at zero (mostly) until I start the query. Then bi shoots up
> to around 2500 (bo remains around zero) until the query finishes.
>
>
> > 7.1 is quite old, but I do understand the pain of migraing to 7.3 [or
> > .4beta] with huge db's
>
> Is the upgrade likely to make a difference?

Well, it's likely to get you better help. Explain Analyze (added in 7.2
IIRC) gets us information on the real time spent in operations as well as
the real number of rows.

But, back to the question, what is the definition of the index it's using?
If you don't have already have an index on (station,valid_time does
making one help?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-10-30 15:36:43 Re: dump schema schema only?
Previous Message scott.marlowe 2003-10-30 15:34:41 Re: formatting of SQL sent by PHP to postgres