Re: PostgreSQL BugTool Submission

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stu Coates <stu(at)stucoates(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: PostgreSQL BugTool Submission
Date: 2000-08-24 03:52:15
Message-ID: 20949.967089135@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

pgsql-bugs(at)postgresql(dot)org writes:
> When performing a query against a table that has a 64bit (int8)
> primary key a sequential scan always takes place.

Possibly a casting issue. Observe:

regression=# create table foo1 (f1 int8 primary key);
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'foo1_pkey' for table 'foo1'
CREATE
regression=# explain select * from foo1 where f1 = 42;
NOTICE: QUERY PLAN:

Seq Scan on foo1 (cost=0.00..22.50 rows=10 width=8)

EXPLAIN
regression=# explain select * from foo1 where f1 = 42::int8;
NOTICE: QUERY PLAN:

Index Scan using foo1_pkey on foo1 (cost=0.00..8.14 rows=10 width=8)

EXPLAIN

The planner is not currently very smart about figuring out whether a
cross-data-type operator (int8-vs-int4-equal, here) can be munged into
the single-data-type operator that's associated with an index. An
explicit cast will prod it in the right direction.

We do plan to fix this, but there's still some debate about how...

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2000-08-24 04:07:18 PostgreSQL BugTool Submission
Previous Message pgsql-bugs 2000-08-24 00:52:05 PostgreSQL BugTool Submission