Index Types
27.5.2.1 Index Types
P ostgre SQL supports the following types of indices:
• B-tree.
The default index type is a B + -tree index based on Lehman and Yao’s B- link trees (B-link trees, described in Section 15.10, support high concurrency
of operations). These indices are useful for equality and range queries on sortable data and also for certain pattern-matching operations such as the like expression.
• Hash. P ostgre SQL ’s hash indices are an implementation of linear hashing (for
more information on hash indices, see Section 11.6.3). Such indices are useful only for simple equality operations. The hash indices used by P ostgre SQL have been shown to have lookup performance no better than that of B-trees, but have considerably larger size and maintenance costs. Moreover, hash indices are the only indices in P ostgre SQL that do not support crash recovery. Thus it is almost always preferable to use B-tree indices instead of hash indices.
• GiST. P ostgre SQL supports a highly extensible index called G i ST , or Gen-
eralized Search Tree. G i ST is a balanced, tree-structured access method that makes it easy for a domain expert who is well versed in a particular data type (such as image data) to develop performance-enhancing indices with- out having to deal with the internal details of the database system. Examples
of some indices built using G i ST include B-trees and R-trees, as well as less conventional indices for multidimensional cubes and full-text search. New
G i ST access methods can be implemented by creating an operator class as explained in Section 27.3.3.3. Operator classes for G i ST are different from B- trees, as each G i ST operator class may have a different set of strategies that
27.5 Storage and Indexing 1149
indicate the search predicates implemented by the index. G i ST also relies on seven support functions for operations such as testing set membership and splitting sets of entries for page overflows.
It is interesting to note that the original P ostgre SQL implementation of R-trees (Section 25.3.5.3) was replaced by G i ST operator classes in version 8.2. This allowed R-trees to take advantage of the WAL logging and concurrency capabilities that were added to G i ST in version 8.1. Since the original R- tree implementation did not have these features, this change illustrates the benefits of an extensible indexing method. See the bibliographical notes for
references to more information on the G i ST index.
• GIN. The newest type of index in P ostgre SQL is the Generalized Inverted
Index ( GIN ). A GIN index interprets both index keys and search keys as sets, making the index type appropriate for set-oriented operators. One of the intended uses of GIN is to index documents for full-text search, which is implemented by reducing documents and queries to sets of search terms.
Like G i ST ,a GIN index may be extended to handle any comparison operator by creating an operator class with appropriate support functions. To evaluate a search, GIN efficiently identifies index keys that overlap the search key, and computes a bitmap indicating which searched-for elements are members of the index key. This is accomplished using support functions that extract members from a set and compare individual members. Another support function decides if the search predicate is satisfied based on the bitmap and the original predicate. If the search predicate cannot be resolved without the full indexed attribute, the decision function must report a match and recheck the predicate in the heap file.
Parts
» Indian Institute of Technology, Bombay
» Data Mining and Information Retrieval
» Structure of Relational Databases
» Database Schema When we talk about a database, we must differentiate between the database
» Basic Structure of SQL Queries
» Modification of the Database
» • Embedded SQL : Like dynamic SQL , embedded SQL provides a means by
» Advanced Aggregation Features**
» The Cartesian-Product Operation
» The Tuple Relational Calculus
» The Entity-Relationship Model
» • For an n-ary relationship set with an arrow on one of its edges, the primary
» Entity-Relationship Design Issues
» Representation of Generalization
» Alternative Notations for Modeling Data
» Other Aspects of Database Design
» Features of Good Relational Designs
» Atomic Domains and First Normal Form
» Decomposition Using Functional Dependencies
» BCNF Decomposition Algorithm
» Decomposition Using Multivalued Dependencies
» Application Programs and User Interfaces
» Overview of Physical Storage Media
» Magnetic Disk and Flash Storage
» Organization of Records in Files
» Comparison of Ordered Indexing and Hashing
» Implementation of Pipelining
» Evaluation Algorithms for Pipelining
» Transformation of Relational Expressions
» (A, r ), the number of distinct values that appear in the relation r for attribute
» Advanced Topics in Query Optimization**
» Transaction Atomicity and Durability
» Transaction Isolation and Atomicity
» Implementation of Isolation Levels
» Transactions as SQL Statements
» Weak Levels of Consistency in Practice
» Concurrency in Index Structures**
» Failure with Loss of Nonvolatile Storage
» Early Lock Release and Logical Undo Operations
» Centralized and Client – Server Architectures
» Parallelism on Multicore Processors
» Recovery and Concurrency Control
» Distributed Query Processing
» Heterogeneous Distributed Databases
» Partitioning and Retrieving Data
» Transactions and Replication
» Decision-Tree Construction Algorithm
» Relevance Ranking Using Terms
» Synonyms, Homonyms, and Ontologies
» Crawling and Indexing the Web
» Information Retrieval: Beyond Ranking of Pages
» Structured Types and Inheritance in SQL
» Array and Multiset Types in SQL
» Application Program Interfaces to XML
» Native Storage within a Relational Database
» Other Issues in Application Development
» Representation of Geographic Data
» Transaction-Processing Monitors
» Real-Time Transaction Systems
» PostgreSQL Implementation of MVCC
» Database Design and Querying Tools
» Database Administration Tools
» Business Intelligence Features
Show more