Re: Why does postgres not take into account my index on a bigint column ?

Поиск
Список
Период
Сортировка
От Michael Loftis
Тема Re: Why does postgres not take into account my index on a bigint column ?
Дата
Msg-id 3CBAEED6.9030202@wgops.com
обсуждение исходный текст
Ответ на Why does postgres not take into account my index on a bigint column ?  ("Pierre-Andre Michel" <pamichel@geneva-link.ch>)
Ответы Re: Why does postgres not take into account my index on a bigint column ?  (Andrew Sullivan <andrew@libertyrms.info>)
Re: Why does postgres not take into account my index on a bigint column ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
IMHO this is a bug in PostgreSQL....  Ints of any type are not supposed
to be quoted, and whether-or-not they are shouldn't affect the planning
and execution of the query...

Anyone from -hackers read this?  Or should I repost it there?

Pierre-Andre Michel wrote:

> Hi,
>
>
>
> I noticed that postgres does not take into account index on BIGINT
> column when the value specified in the WHERE condition is not quoted.
>
> My problem is that I use third part programs that automatically
> generate many select queries where numeric values are not surrounded
> with quotes.
>
>
>
> So does anybody know a way to force postgres to consider using indices
> on bigint columns even when the value in a where cond is not
> surrounded by quotes ?
>
>
>
> Thanks
>
>
>
> ----
>
> For instance, in the following 'header' table I have a bigint column
> 'objectId'. Here is what I get when running the explain command:
>
>
>
> idns_dev=# explain select * from header where objectid = '47866';
>
>
>
> NOTICE:  QUERY PLAN:
> Index Scan using header_pkey on header  (cost=0.00..3.92 rows=1 width=552)
> EXPLAIN
>
>
>
> idns_dev=# explain select * from header where objectid = 47866;
>
>
>
> NOTICE:  QUERY PLAN:
> Seq Scan on header  (cost=0.00..2246.50 rows=1 width=552)
> EXPLAIN
>
> ------
>
>
>
>
>
>
>
> ______________________
> Pierre-André Michel
>
>
>
> SmartGene SA
> PSE Bâtiment C
> EPFL, Ecublens
> CH-1015 Lausanne
>
>
>
> tél. prof.: (+4121) 693 85 84
> mobile:    (+4178) 681 53 03
>



В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: I: Migrating a very large db
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Query planner quirk?