Index optimization ? - Mailing list pgsql-general

From Bo Lorentsen
Subject Index optimization ?
Date
Msg-id 41E95AFF.40505@netgroup.dk
Whole thread Raw
Responses Re: Index optimization ?
Re: Index optimization ?
List pgsql-general
Hi ...

In my quest to get rid of the oid dependency, i have made some new low
level code with the help from many nice people from this community
(thanks for that), but I still have one somewhat big problem.

I am running PG 7.4.6, btw.

I have a "sale" table that have a BIGSERIAL as primary key, but explain
keeps telling me (and so does the performance) that it will perform a
"seq scan" of my table when performing this statement (not using the
pkey index) :

select * from sale where id = currval( 'sale_id_seq' );

I tried this too :

select * from sale where id = currval( 'sale_id_seq' )::bigint;

But this still did not work (still using seq scan) :-(

At last I did a :

explain select * from sale where id = 42::bigint;

Just to make sure, and this made the proper optimizations (used the pkey
index).

What have I done wrong, or do PG still have some casting problems in the
optimizer ?

/BL

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: PQisBusy() always returns TRUE
Next
From: Bo Lorentsen
Date:
Subject: Re: OID Usage