pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gary Stainburn <gary.stainburn@ringways.co.uk>
To: pgsql-sql@postgresql.org
Subject: curious delay on view/where
Date: Thu, 28 Oct 2004 11:16:44 +0100
Message-ID: <200410281116.44972.gary.stainburn@ringways.co.uk> (raw)

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     




view thread (3+ messages)  latest in thread

Message-ID: <200410281116.44972.gary.stainburn@ringways.co.uk>
Permalink:  ../200410281116.44972.gary.stainburn@ringways.co.uk/
Also on:    postgresql.org/message-id/200410281116.44972.gary.stainburn@ringways.co.uk

 · 

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-sql@postgresql.org
  Cc: gary.stainburn@ringways.co.uk
  Subject: Re: curious delay on view/where
  In-Reply-To: <200410281116.44972.gary.stainburn@ringways.co.uk>

* 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