Index optimization ?

Поиск
Список
Период
Сортировка
От Bo Lorentsen
Тема Index optimization ?
Дата
Msg-id 41E95AFF.40505@netgroup.dk
обсуждение исходный текст
Ответы Re: Index optimization ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Index optimization ?  (Michael Fuhr <mike@fuhr.org>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PQisBusy() always returns TRUE
Следующее
От: Bo Lorentsen
Дата:
Сообщение: Re: OID Usage