Re: Difference between "foo is false" and "foo=false"? Partial index on boolean.

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Difference between "foo is false" and "foo=false"? Partial index on boolean.
Дата
Msg-id 46DD1AC8.7050407@archonet.com
обсуждение исходный текст
Ответ на Re: Difference between "foo is false" and "foo=false"? Partial index on boolean.  (Bryce Nesbitt <bryce1@obviously.com>)
Список pgsql-sql
Bryce Nesbitt wrote:
> Tom Lane wrote:
>> Bryce Nesbitt <bryce1@obviously.com> writes:
>>
>> They give different results for NULL --- specifically, NULL for the
>> former and FALSE for the latter.  Don't blame me, it's in the spec...
> Thanks, and Got It.  This particular column is:
>     reconciled       | boolean                     | not null
> On PostgreSQL 8.1.9.

> So given all that, why would the Hibernate query fail to use the partial 
> index?   I eventually created three indexes, and only the hideously large full 
> index increases performance:

> Only the full index prevents a "false" scan from taking 4 seconds:
> 
> LOG:  duration: 4260.575 ms  statement: EXECUTE C_50292  [PREPARE:  select 
> count(vehicleeve0_.VEHICLE_EVENT_ID) as x0_0_ from EG_VEHICLE_EVENT vehicleeve0_ 
> where (vehicleeve0_.CSO_ID=$1 ) and (vehicleeve0_.*RECONCILED=$2* )]

It's a prepared query-plan, which means it can't plan to use the index 
because the next EXECUTE might have reconciled=true.

--   Richard Huxton  Archonet Ltd


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

Предыдущее
От: Bryce Nesbitt
Дата:
Сообщение: Partial index on boolean - Sometimes fails to index scan
Следующее
От: "Marc Mamin"
Дата:
Сообщение: EXECUTE 'EXECUTE ...' or how to use dynamic prepared statements ?