Skip to content

Partial Indexes [CORE3384] #3750

@firebird-automations

Description

@firebird-automations

Submitted by: Vladimir Arkhipov (arkinform)

Votes: 4

Example:

CREATE UNIQUE INDEX orders_number_idx ON orders (number)
WHERE number is not null

Description from http://www.postgresql.org/docs/8.0/static/indexes-partial.html

"A partial index is an index built over a subset of a table; the subset is defined by a conditional expression (called the predicate of the partial index). The index contains entries for only those table rows that satisfy the predicate."

"A major motivation for partial indexes is to avoid indexing common values. Since a query searching for a common value (one that accounts for more than a few percent of all the table rows) will not use the index anyway, there is no point in keeping those rows in the index at all. This reduces the size of the index, which will speed up queries that do use the index. It will also speed up many table update operations because the index does not need to be updated in all cases."

Very very useful !!!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions