Re: Table access method not behaving like Oracle (index vs sequential scan). Examples and stats provided.

Поиск
Список
Период
Сортировка
Искать
От
Greg Stark
Тема
Re: Table access method not behaving like Oracle (index vs sequential scan). Examples and stats provided.
Дата
Msg-id
87isc6rem9.fsf@stark.xeocode.com
Ответ на
Список
Дерево обсуждения
Table access method not behaving like Oracle (index vs sequential scan). Examples and stats provided. "Kevin Macdonald" <nospam@please.thankyou>
Re: Table access method not behaving like Oracle (index vs sequential scan). Examples and stats provided. Manfred Koizar <mkoi-pg@aon.at>
Re: Table access method not behaving like Oracle (index vs sequential scan). Examples and stats provided. Greg Stark <gsstark@mit.edu>

"Kevin Macdonald"  writes:

> QUERY 2: select sobjid from p1_nrn_road where v = 1
> 
> The plan is "Seq Scan on p1_nrn_road (cost=0.00..22158.54 rows=2 width=8)"

Incidentally, you should send the whole plan. In general you should send all
the information you have, not just the parts you think are relevant. The next
line would have clearly shown the problem to someone who knew what to look
for.

try
 where v = '1'
or
 where v = 1::bigint

The problem is that in 7.4 and previous indexes can't be used for cross-type
comparisons and integer constants are assumed to be integer not bigint type.
If you leave it in quotes then postgres doesn't pick a type until it looks at
what you're comparing it with. Or if you cast it then you force it to be a
bigint=bigint comparison.

7.5 will avoid this problem.

-- 
greg
В списке pgsql-general по дате отправления
От: Harald Fuchs
Дата:
Сообщение: Re: Sql injection attacks
От: Jason Tesser
Дата:
Сообщение: Backup questions
FAQ