pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
curious delay on view/where
3+ messages / 2 participants
[nested] [flat]

* curious delay on view/where
@ 2004-10-28 10:16  Gary Stainburn <gary.stainburn@ringways.co.uk>
  0 siblings, 1 reply; 3+ messages in thread

From: Gary Stainburn @ 2004-10-28 10:16 UTC (permalink / raw)
  To: pgsql-sql

Hi folks.

I have the following view:

CREATE VIEW "stock_available" as 
  SELECT * FROM stock_details 
  WHERE available = true AND visible = true AND
  location not in (SELECT descr FROM ignored);

Stock_details is itself a view pulling in a number of tables. Everything 
works fine until I try to pull in only the details for a specific 
branch, using the following.

select * from stock_available where branch = 'Leeds';
or
select * from stock_available where branch = 'Doncaster';

At this point, the query takes 11 seconds. Any other quiery, including

select * from stock_available where branch != 'Doncaster'
and
select * from stock_available where branch != 'Leeds'

which only return the equivelent of the top two (we only have Leeds and 
Doncaster) are les than  1 second.

Anyone got any ideas of the cause, or thoughts on how I can trace the 
problem?

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: curious delay on view/where
@ 2004-10-28 14:25  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Gary Stainburn <gary.stainburn@ringways.co.uk>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2004-10-28 14:25 UTC (permalink / raw)
  To: Gary Stainburn <gary.stainburn@ringways.co.uk>; +Cc: pgsql-sql

Gary Stainburn <gary.stainburn@ringways.co.uk> writes:
> Anyone got any ideas of the cause, or thoughts on how I can trace the 
> problem?

EXPLAIN ANALYZE results for the fast and slow cases would be
interesting.  Also, have you ANALYZEd the underlying tables lately?
And what PG version is this?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: curious delay on view/where
@ 2004-10-28 15:01  Gary Stainburn <gary.stainburn@ringways.co.uk>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Gary Stainburn @ 2004-10-28 15:01 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql

On Thursday 28 October 2004 3:25 pm, Tom Lane wrote:
> Gary Stainburn <gary.stainburn@ringways.co.uk> writes:
> > Anyone got any ideas of the cause, or thoughts on how I can trace
> > the problem?
>
> EXPLAIN ANALYZE results for the fast and slow cases would be
> interesting.  Also, have you ANALYZEd the underlying tables lately?
> And what PG version is this?
>
> 			regards, tom lane

Hi Tom.

I've the analyze but don't understand what it's telling me.  I've made 
it available at http://www.stainburn.com/analyze.txt

Gary
-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-10-28 15:01 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-28 10:16 curious delay on view/where Gary Stainburn <gary.stainburn@ringways.co.uk>
2004-10-28 14:25 ` Tom Lane <tgl@sss.pgh.pa.us>
2004-10-28 15:01   ` Gary Stainburn <gary.stainburn@ringways.co.uk>

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