如何在postgresql中创建位图索引? (它甚至具有位图索引吗?) [英] How to create bitmap index in postgresql ? (Does it even have bitmap index ?)

查看:217
本文介绍了如何在postgresql中创建位图索引? (它甚至具有位图索引吗?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜寻了至少一个小时,但是我找不到如何在postgresql中创建位图索引,因此我的问题很简单,即如何在postgresql中写此命令(来自oracle)

I have been "googling" at least for an hour but I was unable to find how to create a bitmap index in postgresql, so my question is very simple how to write this command (from oracle) in postgresql

CREATE BITMAP INDEX name  ON table (column);


推荐答案

页面位图是为每个查询动态创建的。它不会被缓存或重复使用,并在位图索引扫描结束时被丢弃。

The bitmap of pages is created dynamically for each query. It is not cached or re-used, and is discarded at the end of the bitmap index scan.

事先创建页面位图是没有意义的,因为其内容取决于查询谓词。

It doesn't make sense to create the page bitmap in advance because its contents depend on the query predicates.

位图索引为列的每个可能值创建一个单独的位图(0和1的序列),其中每个位对应于具有索引值的字符串。位图索引最适合于位唯一值(例如性别字段)的数据

Bitmap index create a separate bitmap (a sequence of 0 and 1) for each possible value of the column, where each bit corresponds to a string with an indexed value. Bitmap indexes are optimal for data where bit unique values (example, gender field)

PostgreSQL不提供持久性位图索引。但是它可以在数据库中用于组合多个索引。 PostgreSQL扫描每个需要的索引,并在内存中准备一个位图,以提供表行的位置,据报告该行符合该索引的条件。然后根据查询需要对位图进行与或或运算。最后,访问并返回实际的表行。

PostgreSQL does not provide persistent bitmap index. But it can be used in database to combine multiple indexes. PostgreSQL scans each needed index and prepares a bitmap in memory giving the locations of table rows that are reported as matching that index’s conditions. The bitmaps are then ANDed and ORed together as needed by the query. Finally, the actual table rows are visited and returned.

这篇关于如何在postgresql中创建位图索引? (它甚至具有位图索引吗?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆