Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g16LEXE64080; Wed, 6 Feb 2002 16:14:33 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g16LEXf08778; Wed, 6 Feb 2002 16:14:33 -0500 (EST) To: "Marc G. Fournier" cc: pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: JOIN between three *simple* tables ... In-reply-to: <20020206162412.F57607-100000@earth.hub.org> References: <20020206162412.F57607-100000@earth.hub.org> Comments: In-reply-to "Marc G. Fournier" message dated "Wed, 06 Feb 2002 16:47:45 -0400" Date: Wed, 06 Feb 2002 16:14:33 -0500 Message-ID: <8775.1013030073@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200202/197 X-Sequence-Number: 18525 "Marc G. Fournier" writes: > iwantu=# \d poc_uid > Index "poc_uid" > Column | Type > --------+-------- > uid | bigint > btree > iwantu=# explain select count(1) from orientation_c poc where uid = 1; > NOTICE: QUERY PLAN: > Aggregate (cost=2264.97..2264.97 rows=1 width=0) > -> Seq Scan on orientation_c poc (cost=0.00..2264.96 rows=1 width=0) > EXPLAIN You're forgetting ye olde constant-casting problem. You need something like select count(1) from orientation_c poc where uid = 1::bigint; to use an index on a bigint column. Not sure about the other thing; have you VACUUM ANALYZEd (or at least ANALYZEd) since filling the tables? It looks like the system thinks the tables are much smaller than they really are. regards, tom lane