From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: CoL <col@mportal.hu>
Cc: pgsql-performance@postgresql.org
Subject: Re: subquery and table join, index not use for table
Date: Fri, 16 Jan 2004 09:48:18 -0800 (PST)
Message-ID: <20040116094239.A66040@megazone.bigpanda.com> (raw)
In-Reply-To: <bu3gia$2lq0$1@news.hub.org>
References: <bu3gia$2lq0$1@news.hub.org>
On Wed, 14 Jan 2004, CoL wrote:
[plan1]
> -> Seq Scan on menutable b (cost=0.00..13.01 rows=38 width=22)
> (actual time=0.02..0.38 rows=38 loops=1)
[plan2]
> -> Index Scan using menutable_pkey on menutable b
> (cost=0.00..29.36 rows=38 width=22) (actual time=0.02..0.12 rows=38 loops=1)
It's estimating a cost of 13 for the sequence scan and 29 for the index
scan so it's choosing the sequence scan.
The value of random_page_cost may be too high for your system and
especially so if the database is small and likely to fit in ram. In
addition, if the table in question is small, you'll likely find that at
some point for a larger data set that the system switches over to an index
scan.
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-performance@postgresql.org
Cc: sszabo@megazone.bigpanda.com, col@mportal.hu
Subject: Re: subquery and table join, index not use for table
In-Reply-To: <20040116094239.A66040@megazone.bigpanda.com>
* 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