Skip site navigation (1) Skip section navigation (2)

Re: take my index, please

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Lyn A Headley <laheadle(at)cs(dot)uchicago(dot)edu>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: take my index, please
Date: 2001-04-30 03:58:50
Message-ID: 10085.988603130@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Lyn A Headley <laheadle(at)cs(dot)uchicago(dot)edu> writes:
>                   Table "allocation"
>    Attribute    |           Type           | Modifier 
> ----------------+--------------------------+----------
>  allocation_oid | bigint                   | not null

> webco=# explain select * from allocation where allocation_oid = 5;
> NOTICE:  QUERY PLAN:

> Seq Scan on allocation  (cost=0.00..2295.79 rows=1 width=104)

Try

select * from allocation where allocation_oid = 5::int8;

As you wrote it, it's a cross-datatype operator (int8 vs int4)
and the planner is not very smart about those at the moment.

You should probably also ask yourself whether you *really* need int8
for this column, at least for the next release or two that it's likely
to be before something is done about this problem.

			regards, tom lane

In response to

pgsql-novice by date

Next:From: J. Patrick LaniganDate: 2001-04-30 05:01:11
Subject: Include and lib dirs under RH7?
Previous:From: suhail sarwarDate: 2001-04-29 16:55:24
Subject: Variables in SQL statements

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group