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 069CC3A430C for ; Thu, 28 Oct 2004 15:49:13 +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 14415-07 for ; Thu, 28 Oct 2004 14:49:00 +0000 (GMT) Received: from relay3.uol.com.br (relay3.uol.com.br [200.221.4.110]) by svr1.postgresql.org (Postfix) with ESMTP id 50BFF3A48BD for ; Thu, 28 Oct 2004 15:49:03 +0100 (BST) Received: from uol.com.br (unknown [172.26.5.184]) by shark3.mail.sys.intranet (Postfix) with ESMTP id C7AB835068 for ; Thu, 28 Oct 2004 11:49:01 -0300 (BRT) Date: Thu, 28 Oct 2004 11:53:25 -0300 Message-Id: Subject: Re: extra info - curious delay on view/where MIME-Version: 1.0 X-Sensitivity: 3 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable From: "andre.toscano" To: "pgsql-sql" X-XaM3-API-Version: 4.1 (B79) X-type: 0 X-SenderIP: 201.12.132.206 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/204 X-Sequence-Number: 19307 Hi Folks, It=B4s just for curiosity I ask: Could an INDEX speed up that SELECT? Thanks in advance, and sorry for my newbies questions. Andr=E9 (Brazilian User) > 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 =3D true AND visible =3D 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 =3D 'Leeds'; > > or > > select * from stock_available where branch =3D '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 > > > ---------------------------(end of broadcast)--------------- ------------ > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match > =0A =0A________________________________________________________________= __________=0AAcabe com aquelas janelinhas que pulam na sua tela.=0AAntiPo= p-up UOL - =C9 gr=E1tis!=0Ahttp://antipopup.uol.com.br/=0A