From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marc G. Fournier <scrappy@hub.org>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: JOIN between three *simple* tables ...
Date: Wed, 06 Feb 2002 16:14:33 -0500
Message-ID: <8775.1013030073@sss.pgh.pa.us> (raw)
In-Reply-To: <20020206162412.F57607-100000@earth.hub.org>
References: <20020206162412.F57607-100000@earth.hub.org>
"Marc G. Fournier" <scrappy@hub.org> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, scrappy@hub.org, pgsql-hackers@postgresql.org
Subject: Re: JOIN between three *simple* tables ...
In-Reply-To: <8775.1013030073@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox