X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5CD185E46CD for ; Tue, 31 Aug 2004 17:41:24 -0300 (ADT) 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 56547-06 for ; Tue, 31 Aug 2004 20:41:18 +0000 (GMT) Received: from mx.noos.fr (pm-mx6.mgn.net [195.46.220.208]) by svr1.postgresql.org (Postfix) with ESMTP id 370905E3F15 for ; Tue, 31 Aug 2004 17:41:17 -0300 (ADT) Received: from localhost (pm-mnet6.mgn.net [195.46.220.215]) by mx.noos.fr (Postfix) with SMTP id F14C8268BA; Tue, 31 Aug 2004 22:41:15 +0200 (MEST) X-Mailbox-Line: From footcow@noos.fr Tue Aug 31 22:41:15 2004 Received: from e115.dhcp212-198-145.noos.fr (e115.dhcp212-198-145.noos.fr [212.198.145.115]) by pm-mnet6.mgn.net with ESMTP; Tue, 31 Aug 2004 22:41:15 (MEST) From: =?iso-8859-1?q?Herv=E9_Piedvache?= To: Jean-Max Reymond Subject: Re: Optimizing a request Date: Tue, 31 Aug 2004 22:41:15 +0200 User-Agent: KMail/1.7 Cc: pgsql-performance@postgresql.org References: <4b09a0c0408311159fa91802@mail.gmail.com> In-Reply-To: <4b09a0c0408311159fa91802@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200408312241.15315.footcow@noos.fr> 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: 200408/487 X-Sequence-Number: 8123 Hi, Le Mardi 31 Ao=FBt 2004 20:59, Jean-Max Reymond a =E9crit : > explain SELECT art_id, art_titre, art_texte, rub_titre > FROM article inner join rubrique on article.rub_id =3D rubrique.rub_id > where rub_parent =3D 8; > > Hash Join (cost=3D8.27..265637.59 rows=3D25 width=3D130) > Hash Cond: ("outer".rub_id =3D "inner".rub_id) > -> Seq Scan on article (cost=3D0.00..215629.00 rows=3D10000000 width= =3D108) > -> Hash (cost=3D8.26..8.26 rows=3D3 width=3D22) > -> Index Scan using rubrique_parent on rubrique > (cost=3D0.00..8.26 rows=3D3 width=3D22) > Index Cond: (rub_parent =3D 8) > What are the values in rub_parent ... is their many disparity in the values= ? May be you have most of the value set to 8 ... and may be the optimizer thi= nk=20 a seq scan is better than the use of an index ... Could you do a simple : SELECT rub_parent, count(rub_id) FROM rubrique=20 GROUP BY rub_parent; Just to see the disparity of the values ... regards, --=20 Bill Footcow