คำถามติดแท็ก postgresql-8.3

1
Seq Scan ที่ไม่คาดคิดเมื่อทำเคียวรีกับบูลีนที่มีค่า NULL
ฉันมีคอลัมน์ฐานข้อมูลที่เรียกว่าที่คอลัมน์ชนิดคือauto_review booleanมีดัชนีสำหรับฟิลด์นั้นซึ่งสร้างโดยใช้ ActiveRecord ORM CREATE INDEX index_table_on_auto_renew ON table USING btree (auto_renew); เมื่อฉันสอบถามฟิลด์สำหรับค่าบูลีน PG จะใช้ดัชนีตามที่คาดไว้ EXPLAIN for: SELECT "table".* FROM "table" WHERE "table"."auto_renew" = 'f' QUERY PLAN ---------------------------------------------------------------------------------------------- Bitmap Heap Scan on table (cost=51.65..826.50 rows=28039 width=186) Filter: (NOT auto_renew) -> Bitmap Index Scan on index_domains_on_auto_renew (cost=0.00..44.64 rows=2185 width=0) Index Cond: …
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.