X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 136633A485F for ; Thu, 28 Oct 2004 11:47:23 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34655-03 for ; Thu, 28 Oct 2004 10:47:11 +0000 (GMT) Received: from stan.ringways.co.uk (hub.ringways.co.uk [213.38.87.130]) by svr1.postgresql.org (Postfix) with ESMTP id 113013A2C22 for ; Thu, 28 Oct 2004 11:47:13 +0100 (BST) Received: from gary.ringways.co.uk ([10.1.1.2]) by stan.ringways.co.uk with esmtp (Exim 3.22 #1) id 1CN7t8-0000wi-00 for pgsql-sql@postgresql.org; Thu, 28 Oct 2004 11:52:14 +0100 Content-Type: text/plain; charset="iso-8859-1" From: Gary Stainburn Organization: Ringways Garages Ltd To: pgsql-sql@postgresql.org Subject: Re: extra info - curious delay on view/where Date: Thu, 28 Oct 2004 11:42:46 +0100 User-Agent: KMail/1.4.3 References: <200410281116.44972.gary.stainburn@ringways.co.uk> In-Reply-To: <200410281116.44972.gary.stainburn@ringways.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200410281142.46266.gary.stainburn@ringways.co.uk> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/201 X-Sequence-Number: 19304 On Thursday 28 October 2004 11:16 am, Gary Stainburn wrote: > 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 [snip] Once thing I forgot to mention. If I run the above on the base view stock_details, it returns in < 1 second too. -- 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