Search Postgresql Archives

Index optimization ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
     joining column's datatypes do not match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux