Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0172B476086 for ; Sun, 12 Jan 2003 12:07:11 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 81D63476094 for ; Sun, 12 Jan 2003 12:07:10 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id 5EEDC43A87A; Sun, 12 Jan 2003 12:07:10 -0500 (EST) From: "Gaetano Mendola" X-Newsgroups: comp.databases.postgresql.admin Subject: Re: Query optimization path Date: Sun, 12 Jan 2003 18:07:14 +0100 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 31 Message-ID: References: <20030112170108.GB31080@wolff.to> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 To: pgsql-admin@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/110 X-Sequence-Number: 6952 "Bruno Wolff III" wrote in message news:20030112170108.GB31080@wolff.to... > Gaetano Mendola wrote: > > Hi all, > > > > I have the following query: > > > > SELECT count(1) > > FROM providers p JOIN class_default cd USING (id_provider) > > JOIN user_data ud USING (id_class) > > JOIN v_user_traffic ut USING (id_user) > > WHERE id_user_status in (4,5) AND > > p.company = 'XXXXX'; > > > > is not slow but I notice that if I do explain analyze with the table > > reordered > > inside the select in another way the cost change. > Using "JOIN" fixes the order that tables are joined in. If you are > just doing inner joins, then you probably don't want to use the "JOIN" > keyword. The exception being when there are so many tables being joined > that you want to manually specify at least some of the join ordering in > order to help out the planner. And where is written this behavior ? Is it SQL standard ? Ciao Gaetano.