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 103593A4897 for ; Thu, 28 Oct 2004 11:21:16 +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 24967-08 for ; Thu, 28 Oct 2004 10:21:12 +0000 (GMT) Received: from stan.ringways.co.uk (hub.ringways.co.uk [213.38.87.130]) by svr1.postgresql.org (Postfix) with ESMTP id 69FFF3A4883 for ; Thu, 28 Oct 2004 11:21: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 1CN7Tw-0000ZN-00 for pgsql-sql@postgresql.org; Thu, 28 Oct 2004 11:26:12 +0100 Content-Type: text/plain; charset="us-ascii" From: Gary Stainburn Organization: Ringways Garages Ltd To: pgsql-sql@postgresql.org Subject: curious delay on view/where Date: Thu, 28 Oct 2004 11:16:44 +0100 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200410281116.44972.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/200 X-Sequence-Number: 19303 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