Partial index where clause not filtering through
От | Jim C. Nasby |
---|---|
Тема | Partial index where clause not filtering through |
Дата | |
Msg-id | 20030616003118.S66185@flake.decibel.org обсуждение исходный текст |
Ответы |
Re: Partial index where clause not filtering through
|
Список | pgsql-performance |
I have the following index: street_range__street_locality_high_low_v btree (street_name_id, locality_id, addr_high_v, addr_low_v) WHERE (addr_high_v IS NOT NULL) The query has a where clause like this: FROM street_range s, input i WHERE 1=1 AND i.address_v IS NOT NULL AND s.locality_id = i.locality_id AND s.street_name_id = i.street_name_id AND s.addr_low_v <= i.address_v AND s.addr_high_v >= i.address_v As-is, it won't use the index. i.address_v IS NOT NULL AND s.addr_high_v >= i.address_v should mandate that s.addr_high_v must be not-null, if I'm remembering how nulls work correctly. (Actually, having any kind of comparison on s.addr_high_v should mandate NOT NULL since NULL != NULL, right?) Therefore the optimizer should be able to deduce that it can use the index. Adding AND s.addr_high_v IS NOT NULL to the where clause makes everything work fine, so there is a work-around. Just seems like a minor item to add to the TODO. -- Jim C. Nasby (aka Decibel!) jim@nasby.net Member: Triangle Fraternity, Sports Car Club of America Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?"
В списке pgsql-performance по дате отправления: