我有一个包含数亿行数据的表格,其模式如下所示。
tabe AA {
id integer primay key,
prop0 boolean not null,
prop1 boolean not null,
prop2 smallint not null,
...
}
"属性"字段(prop0,prop1等)每个都只有少数不同的值。我通常会根据这些属性字段的给定条件查询“id”。我认为位图索引最适合这种查询。但是PostgreSQL似乎不支持位图索引。
我尝试了在每个字段上使用B树索引,但是根据查询解释,这些索引未被使用。
是否有更好的替代方法来解决这个问题?
(我正在使用PostgreSQL 9)