SlideShare a Scribd company logo
1 of 53
Download to read offline
Flexible Indexing with Postgres
BRUCE MOMJIAN
December, 2014
Postgres offers a wide variety of indexing structures, and many
index lookup methods with specialized capabilities.This talk
explores the many Postgres indexing options. Includes concepts from
Teodor Sigaev, Alexander Korotkov, Oleg Bartunov, Jonathan Katz
Creative Commons Attribution License http://momjian.us/presentations
1 / 53
PostgreSQL the database…
◮ Open Source Object Relational DBMS since 1996
◮ Distributed under the PostgreSQL License
◮ Similar technical heritage as Oracle, SQL Server & DB2
◮ However, a strong adherence to standards (ANSI-SQL 2008)
◮ Highly extensible and adaptable design
◮ Languages, indexing, data types, etc.
◮ E.g. PostGIS, JSONB, SQL/MED
◮ Extensive use throughout the world for applications and
organizations of all types
◮ Bundled into Red Hat Enterprise Linux, Ubuntu, CentOS
and Amazon Linux
Flexible Indexing with Postgres 2 / 53
PostgreSQL the community…
◮ Independent community led by a Core Team of six
◮ Large, active and vibrant community
◮ www.postgresql.org
◮ Downloads, Mailing lists, Documentation
◮ Sponsors sampler:
◮ Google, Red Hat, VMWare, Skype, Salesforce, HP and
EnterpriseDB
◮ http://www.postgresql.org/community/
Flexible Indexing with Postgres 3 / 53
EnterpriseDB the company…
◮ The worldwide leader of Postgres based products and
services founded in 2004
◮ Customers include 50 of the Fortune 500 and 98 of the
Forbes Global 2000
◮ Enterprise offerings:
◮ PostgreSQL Support, Services and Training
◮ Postgres Plus Advanced Server with Oracle Compatibility
◮ Tools for Monitoring, Replication, HA, Backup & Recovery
Community
◮ Citizenship
◮ Contributor of key features: Materialized Views, JSON, &
more
◮ Nine community members on staff
Flexible Indexing with Postgres 4 / 53
EnterpriseDB the company…
Flexible Indexing with Postgres 5 / 53
Outline
1. Traditional indexing
2. Expression indexes
3. Partial indexes
4. Benefits of bitmap index scans
5. Non-b-tree index types
6. Data type support for index types
7. Index usage summary
Flexible Indexing with Postgres 6 / 53
Traditional Indexing
https://www.flickr.com/photos/ogimogi/
Flexible Indexing with Postgres 7 / 53
B-Tree
◮ Ideal for looking up unique values and maintaining unique
indexes
◮ High concurrency implementation
◮ Index is key/row-pointer, key/row-pointer
◮ Supply ordered data for queries
◮ ORDER BY clauses (and LIMIT)
◮ Merge joins
◮ Nested loop with index scans
Flexible Indexing with Postgres 8 / 53
But I Want More!
◮ Index expressions/functions
◮ Row control
◮ Index non-linear data
◮ Closest-match searches
◮ Index data with many duplicates
◮ Index multi-valued fields
Flexible Indexing with Postgres 9 / 53
Expression Index
SELECT * FROM customer WHERE lower(name) = ’andy’;
CREATE INDEX i_customer_name ON customer (name);
CREATE INDEX i_customer_lower ON customer (lower(name));
Flexible Indexing with Postgres 10 / 53
Let’s Test It
CREATE TABLE customer (name) AS
SELECT ’cust’ || i
FROM generate_series(1, 1000) AS g(i);
SELECT 1000
CREATE INDEX i_customer_name ON customer (name);
CREATE INDEX
EXPLAIN SELECT * FROM customer WHERE name = ’cust999’;
QUERY PLAN
------------------------------------------------------
Index Only Scan using i_customer_name on customer ...
Index Cond: (name = ’cust999’::text)
EXPLAIN SELECT * FROM customer WHERE lower(name) = ’cust999’;
QUERY PLAN
---------------------------------------------------------
Seq Scan on customer (cost=0.00..20.00 rows=5 width=7)
Filter: (lower(name) = ’cust999’::text)
Flexible Indexing with Postgres 11 / 53
Create an Expression Index
CREATE INDEX i_customer_lower ON customer (lower(name));
CREATE INDEX
EXPLAIN SELECT * FROM customer WHERE lower(name) = ’cust999’;
QUERY PLAN
---------------------------------------------------------------
Bitmap Heap Scan on customer (cost=4.32..9.66 rows=5 width=7)
Recheck Cond: (lower(name) = ’cust999’::text)
-> Bitmap Index Scan on i_customer_lower ...
Index Cond: (lower(name) = ’cust999’::text)
Flexible Indexing with Postgres 12 / 53
Other Expression Index Options
◮ User-defined functions
◮ Concatenation of columns
◮ Math expressions
◮ Only IMMUTABLE functions can be used
◮ Consider casting when matching WHERE clause expressions
to the indexed expression
Flexible Indexing with Postgres 13 / 53
Partial Index: Index Row Control
◮ Why index every row if you are only going to look up some
of them?
◮ Smaller index on disk and in memory
◮ More shallow index
◮ Less INSERT/UPDATE index overhead
◮ Sequential scan still possible
Flexible Indexing with Postgres 14 / 53
Partial Index Creation
ALTER TABLE customer ADD COLUMN state CHAR(2);
ALTER TABLE
UPDATE customer SET state = ’AZ’
WHERE name LIKE ’cust9__’;
UPDATE 100
CREATE INDEX i_customer_state_az ON customer (state) WHERE state = ’AZ’;
CREATE INDEX
Flexible Indexing with Postgres 15 / 53
Test the Partial Index
EXPLAIN SELECT * FROM customer WHERE state = ’PA’;
QUERY PLAN
----------------------------------------------------------
Seq Scan on customer (cost=0.00..17.50 rows=5 width=19)
Filter: (state = ’PA’::bpchar)
EXPLAIN SELECT * FROM customer WHERE state = ’AZ’;
QUERY PLAN
----------------------------------------------------------------------------
Bitmap Heap Scan on customer (cost=4.18..9.51 rows=5 width=19)
Recheck Cond: (state = ’AZ’::bpchar)
-> Bitmap Index Scan on i_customer_state_az ...
Index Cond: (state = ’AZ’::bpchar)
Flexible Indexing with Postgres 16 / 53
Partial Index With Different Indexed Column
DROP INDEX i_customer_name;
DROP INDEX
CREATE INDEX i_customer_name_az ON customer (name) WHERE state = ’AZ’;
CREATE INDEX
EXPLAIN SELECT * FROM customer WHERE name = ’cust975’;
QUERY PLAN
----------------------------------------------------------
Seq Scan on customer (cost=0.00..17.50 rows=1 width=19)
Filter: (name = ’cust975’::text)
Index Cond: (state = ’AZ’::bpchar)
Flexible Indexing with Postgres 17 / 53
Partial Index With Different Indexed Column
EXPLAIN SELECT * FROM customer
WHERE name = ’cust975’ AND state = ’AZ’;
QUERY PLAN
-----------------------------------------------------
Index Scan using i_customer_name_az on customer ...
Index Cond: (name = ’cust975’::text)
EXPLAIN SELECT * FROM customer
WHERE state = ’AZ’;
QUERY PLAN
----------------------------------------------------------------
Bitmap Heap Scan on customer (cost=4.17..9.50 rows=5 width=19)
Recheck Cond: (state = ’AZ’::bpchar)
-> Bitmap Index Scan on i_customer_name_az ...
Flexible Indexing with Postgres 18 / 53
Benefits of Bitmap Index Scans
◮ Used when:
◮ an index lookup might generate multiple hits on the same
heap (data) page
◮ using multiple indexes for a single query is useful
◮ Creates a bitmap of matching entries in memory
◮ Row or block-level granularity
◮ Bitmap allows heap pages to be visited only once for
multiple matches
◮ Bitmap can merge the results from several indexes with
AND/OR filtering
◮ Automatically enabled by the optimizer
Flexible Indexing with Postgres 19 / 53
Bitmap Index Scan
=&
Combined
’A’ AND ’NS’
1
0
1
0
TableIndex 1
col1 = ’A’
Index 2
1
0
0
col2 = ’NS’
1 0
1
0
0
Index
Flexible Indexing with Postgres 20 / 53
Non-B-Tree Index Types
https://www.flickr.com/photos/archeon/
Flexible Indexing with Postgres 21 / 53
Generalized Inverted Index (GIN)
◮ Best for indexing values that can contain multiple keys, e.g.
◮ text documents
◮ JSON
◮ multi-dimensional data
◮ Also ideal for columns that contain many duplicates
◮ Key is stored only once
◮ Index is key/many-row-pointers
◮ Index updates are batched, though always checked for
accuracy
◮ In Postgres 9.4
◮ compression of row pointer list
◮ optimized multi-key filtering
Flexible Indexing with Postgres 22 / 53
Generalized Search Tree (GIST)
GIST is a general indexing framework designed to allow indexing
of complex data types with minimal programming. Supported
data types include:
◮ geometric types
◮ range types
◮ hstore (key/value pairs)
◮ intarray (integer arrays)
◮ pg_trgm (trigrams)
Supports optional “distance” for nearest-neighbors/closest
matches. (GIN is also generalized.)
Flexible Indexing with Postgres 23 / 53
Space-Partitioned Generalized Search Tree
(SP-GIST)
◮ Similar to GIST in that it is a generalized indexing framework
◮ Allows the key to be split apart (decomposed)
◮ Parts are indexed hierarchically into partitions
◮ Partitions are of different sizes
◮ Each child needs to store only the child-unique portion of
the original value because each entry in the partition shares
the same parent value.
Flexible Indexing with Postgres 24 / 53
Hash Indexes
◮ Equality, non-equality lookups; no range lookups
◮ Not crash-safe
◮ Not replicated
◮ Cannot be restored via point-in-time recovery
◮ Poor performance and concurrency characteristics
◮ Boo
Flexible Indexing with Postgres 25 / 53
I Am Not Making This Up
SELECT amname, obj_description(oid, ’pg_am’)
FROM pg_am ORDER BY 1;
amname | obj_description
--------+-----------------------------
btree | b-tree index access method
gin | GIN index access method
gist | GiST index access method
hash | hash index access method
spgist | SP-GiST index access method
Flexible Indexing with Postgres 26 / 53
Data Type Support for Index Types
https://www.flickr.com/photos/jonobass/
Flexible Indexing with Postgres 27 / 53
Finding Supported Data Types - B-Tree
SELECT opfname FROM pg_opfamily, pg_am
WHERE opfmethod = pg_am.oid AND amname = ’btree’ ORDER BY 1;
abstime_ops jsonb_ops text_ops
array_ops macaddr_ops text_pattern_ops
bit_ops money_ops tid_ops
bool_ops name_ops time_ops
bpchar_ops network_ops timetz_ops
bpchar_pattern_ops numeric_ops tinterval_ops
bytea_ops oid_ops tsquery_ops
char_ops oidvector_ops tsvector_ops
datetime_ops pg_lsn_ops uuid_ops
enum_ops range_ops varbit_ops
float_ops record_image_ops
integer_ops record_ops
interval_ops reltime_ops
These data types are mostly single-value and easily ordered.
B-tree support for multi-valued types like tsvector is only for
complete-field equality comparisons.
Flexible Indexing with Postgres 28 / 53
Finding Supported Data Types - GIN
SELECT opfname FROM pg_opfamily, pg_am
WHERE opfmethod = pg_am.oid AND amname = ’gin’ ORDER BY 1;
opfname
----------------
array_ops
jsonb_ops
jsonb_path_ops
tsvector_ops
These date types are multi-value, where each value is
independent.
Flexible Indexing with Postgres 29 / 53
Finding Supported Data Types - GIST
SELECT opfname FROM pg_opfamily, pg_am
WHERE opfmethod = pg_am.oid AND amname = ’gist’ ORDER BY 1;
opfname
--------------
box_ops
circle_ops
jsonb_ops
network_ops
point_ops
poly_ops
range_ops
tsquery_ops
tsvector_ops
These date types are multi-value — some have independent
values (JSON, tsvector), others have dependent values (point,
box).
Flexible Indexing with Postgres 30 / 53
Finding Supported Data Types - SP-GIST
SELECT opfname FROM pg_opfamily, pg_am
WHERE opfmethod = pg_am.oid AND amname = ’spgist’ ORDER BY 1;
opfname
----------------
kd_point_ops
quad_point_ops
range_ops
text_ops
For text, this is useful when the keys are long.
Flexible Indexing with Postgres 31 / 53
Index Type Examples
https://www.flickr.com/photos/samcatchesides/
Flexible Indexing with Postgres 32 / 53
B-Tree
C
Item Item Item
Special< N< F
>= N
G
Internal
Leaf
Page Header Item Item Item
SpecialC
E
A
Heap
Page Header Item Item Item
SpecialK
L
G
M I A E P K W L
Page Header
Flexible Indexing with Postgres 33 / 53
GIN Example Using tsvector_ops
CREATE TABLE articles (doc TSVECTOR);
CREATE TABLE
INSERT INTO articles VALUES (’The fox is sick’);
INSERT 0 1
INSERT INTO articles VALUES (’How sick is this’);
INSERT 0 1
SELECT ctid, * FROM articles ORDER BY 1;
ctid | doc
-------+---------------------------
(0,1) | ’The’ ’fox’ ’is’ ’sick’
(0,2) | ’How’ ’is’ ’sick’ ’this’
Flexible Indexing with Postgres 34 / 53
GIN Example Using tsvector_ops
SELECT ctid, * FROM articles ORDER BY 1;
ctid | doc
-------+---------------------------
(0,1) | ’The’ ’fox’ ’is’ ’sick’
(0,2) | ’How’ ’is’ ’sick’ ’this’
fox (0,1)
is (0,1), (0,2)
sick (0,1), (0,2)
this (0,2)
How (0,2)
The (0,1)
Integer arrays are indexed similarly.
Flexible Indexing with Postgres 35 / 53
GIN Example Using JSON
CREATE TABLE webapp (doc JSON);
CREATE TABLE
INSERT INTO webapp VALUES
(’{"name" : "Bill", "active" : true}’);
INSERT 0 1
INSERT INTO webapp VALUES
(’{"name" : "Jack", "active" : true}’);
INSERT 0 1
SELECT ctid, * FROM webapp ORDER BY 1;
ctid | doc
-------+------------------------------------
(0,1) | {"name" : "Bill", "active" : true}
(0,2) | {"name" : "Jack", "active" : true}
Flexible Indexing with Postgres 36 / 53
GIN Example Using jsonb_ops (default)
(0,1) | {"name" : "Bill", "active" : true}
(0,2) | {"name" : "Jack", "active" : true}
CREATE INDEX i_webapp_yc ON webapp
USING gin (doc /* jsonb_ops */);
active (0,1), (0,2)
name (0,1), (0,2)
true (0,1), (0,2)
Bill (0,1)
Jack (0,2)
Flexible Indexing with Postgres 37 / 53
GIN Example Using jsonb_path_ops
(0,1) | {"name" : "Bill", "active" : true}
(0,2) | {"name" : "Jack", "active" : true}
CREATE INDEX i_webapp_doc_path ON webapp
USING gin (doc jsonb_path_ops);
hash(active, true) (0,1), (0,2)
hash(name, Bill) (0,1)
hash(name, Jack) (0,2)
Nested keys have their parent keys (paths) prepended before
hashing.
Flexible Indexing with Postgres 38 / 53
GIST
◮ Supports data types with loosely-coupled values, like
tsvector, JSONB
◮ Uniquely supports data types with tightly-coupled values
◮ multi-dimensional types (geographic)
◮ range types
◮ IP network data type
Flexible Indexing with Postgres 39 / 53
Linear Indexing
0 5−5
0 5−5
0 5−5
= 2
>= 2
Flexible Indexing with Postgres 40 / 53
Multi-Dimensional
5−5
x
y
Flexible Indexing with Postgres 41 / 53
Linear Methods Are Inefficient
5−5
x
y
x >= 2
x
Flexible Indexing with Postgres 42 / 53
R-Tree Indexes Bounding Boxes
5−5
x
y
x
Level 1
Level 3
Level 2
Geographic objects (lines, polygons) also can appear in r-tree
indexes. based on their own bounding boxes.
Flexible Indexing with Postgres 43 / 53
GIST Two-Dimensional Ops
box_ops
circle_ops
point_ops
poly_ops
PostGIS also uses this indexing method.
Flexible Indexing with Postgres 44 / 53
Range Indexing With GIST
GIST range type indexing uses large ranges at the top level of the
index, with ranges decreasing in size at lower levels, just like how
r-tree bounding boxes are indexed.
Flexible Indexing with Postgres 45 / 53
SP-GIST TEXT_OPS Example (Suffix Tree)
yahoo.com/google.com/
http://
index.html
maps.html
index.html
flickr.html cgi.html
google.com/public/ berkeley.edu/
README
ftp://
bin.tar.gz
doc.pdf
Internally split by character. B-trees use range partitioning, e.g.
A-C, rather than common prefix partitioning, so a btree key must
store the full key value.
Flexible Indexing with Postgres 46 / 53
Other SP-GIST Index Examples
◮ quad_point_ops uses four corner points in square partitions of
decreasing size
◮ kd_point_ops splits on only one dimension
Flexible Indexing with Postgres 47 / 53
Extension Index Support
◮ btree_gin (GIN)
◮ btree_gist (GIST)
◮ cube (GIST)
◮ hstore (GIST, GIN)
◮ intarray (GIST, GIN)
◮ ltree (GIST)
◮ pg_trgm (GIST, GIN)
◮ PostGIS
◮ seg
Flexible Indexing with Postgres 48 / 53
Index Usage Summary
https://www.flickr.com/photos/jubilo/
Flexible Indexing with Postgres 49 / 53
When To Create Indexes
◮ pg_stat_user_tables.seq_scan is high
◮ Check frequently-executed queries with EXPLAIN (find via
pg_stat_statements or pgbadger)
◮ Squential scans are not always bad
◮ If pg_stat_user_indexes.idx_scan is low,the index might be
unnecessary
◮ Unnecessary indexes use storage space and slow down
INSERTs and some UPDATEs
Flexible Indexing with Postgres 50 / 53
Evaluating Index Types
◮ Build time, INSERT/UPDATE overhead
◮ Storage size
◮ Access speed
◮ Operator lookup flexibility
Flexible Indexing with Postgres 51 / 53
Additional Resources…
◮ Postgres Downloads:
◮ www.enterprisedb.com/downloads
◮ Product and Services information:
◮ info@enterprisedb.com
Flexible Indexing with Postgres 52 / 53
Conclusion
http://momjian.us/presentations https://www.flickr.com/photos/philipp_zurmoehle/
Flexible Indexing with Postgres 53 / 53

More Related Content

What's hot

PostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsCommand Prompt., Inc
 
MySQL Architecture and Engine
MySQL Architecture and EngineMySQL Architecture and Engine
MySQL Architecture and EngineAbdul Manaf
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Alexey Lesovsky
 
MYSQL Aggregate Functions
MYSQL Aggregate FunctionsMYSQL Aggregate Functions
MYSQL Aggregate FunctionsLeroy Blair
 
Mysql index
Mysql indexMysql index
Mysql indexYuan Yao
 
Introduction of sql server indexing
Introduction of sql server indexingIntroduction of sql server indexing
Introduction of sql server indexingMahabubur Rahaman
 
What is new in PostgreSQL 14?
What is new in PostgreSQL 14?What is new in PostgreSQL 14?
What is new in PostgreSQL 14?Mydbops
 
[Pgday.Seoul 2017] 6. GIN vs GiST 인덱스 이야기 - 박진우
[Pgday.Seoul 2017] 6. GIN vs GiST 인덱스 이야기 - 박진우[Pgday.Seoul 2017] 6. GIN vs GiST 인덱스 이야기 - 박진우
[Pgday.Seoul 2017] 6. GIN vs GiST 인덱스 이야기 - 박진우PgDay.Seoul
 
Innodb에서의 Purge 메커니즘 deep internal (by 이근오)
Innodb에서의 Purge 메커니즘 deep internal (by  이근오)Innodb에서의 Purge 메커니즘 deep internal (by  이근오)
Innodb에서의 Purge 메커니즘 deep internal (by 이근오)I Goo Lee.
 
Redo log improvements MYSQL 8.0
Redo log improvements MYSQL 8.0Redo log improvements MYSQL 8.0
Redo log improvements MYSQL 8.0Mydbops
 
Postgresql database administration volume 1
Postgresql database administration volume 1Postgresql database administration volume 1
Postgresql database administration volume 1Federico Campoli
 
How to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better PerformanceHow to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better Performanceoysteing
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slidesmetsarin
 
Power JSON with PostgreSQL
Power JSON with PostgreSQLPower JSON with PostgreSQL
Power JSON with PostgreSQLEDB
 
redis 소개자료 - 네오클로바
redis 소개자료 - 네오클로바redis 소개자료 - 네오클로바
redis 소개자료 - 네오클로바NeoClova
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLCommand Prompt., Inc
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바NeoClova
 
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...
HTTP Analytics for 6M requests per second using ClickHouse, by  Alexander Boc...HTTP Analytics for 6M requests per second using ClickHouse, by  Alexander Boc...
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...Altinity Ltd
 

What's hot (20)

PostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System Administrators
 
MySQL Architecture and Engine
MySQL Architecture and EngineMySQL Architecture and Engine
MySQL Architecture and Engine
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
 
MYSQL Aggregate Functions
MYSQL Aggregate FunctionsMYSQL Aggregate Functions
MYSQL Aggregate Functions
 
The PostgreSQL Query Planner
The PostgreSQL Query PlannerThe PostgreSQL Query Planner
The PostgreSQL Query Planner
 
Mysql index
Mysql indexMysql index
Mysql index
 
Introduction of sql server indexing
Introduction of sql server indexingIntroduction of sql server indexing
Introduction of sql server indexing
 
What is new in PostgreSQL 14?
What is new in PostgreSQL 14?What is new in PostgreSQL 14?
What is new in PostgreSQL 14?
 
[Pgday.Seoul 2017] 6. GIN vs GiST 인덱스 이야기 - 박진우
[Pgday.Seoul 2017] 6. GIN vs GiST 인덱스 이야기 - 박진우[Pgday.Seoul 2017] 6. GIN vs GiST 인덱스 이야기 - 박진우
[Pgday.Seoul 2017] 6. GIN vs GiST 인덱스 이야기 - 박진우
 
Innodb에서의 Purge 메커니즘 deep internal (by 이근오)
Innodb에서의 Purge 메커니즘 deep internal (by  이근오)Innodb에서의 Purge 메커니즘 deep internal (by  이근오)
Innodb에서의 Purge 메커니즘 deep internal (by 이근오)
 
Redo log improvements MYSQL 8.0
Redo log improvements MYSQL 8.0Redo log improvements MYSQL 8.0
Redo log improvements MYSQL 8.0
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
Postgresql database administration volume 1
Postgresql database administration volume 1Postgresql database administration volume 1
Postgresql database administration volume 1
 
How to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better PerformanceHow to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better Performance
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
Power JSON with PostgreSQL
Power JSON with PostgreSQLPower JSON with PostgreSQL
Power JSON with PostgreSQL
 
redis 소개자료 - 네오클로바
redis 소개자료 - 네오클로바redis 소개자료 - 네오클로바
redis 소개자료 - 네오클로바
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바
 
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...
HTTP Analytics for 6M requests per second using ClickHouse, by  Alexander Boc...HTTP Analytics for 6M requests per second using ClickHouse, by  Alexander Boc...
HTTP Analytics for 6M requests per second using ClickHouse, by Alexander Boc...
 

Viewers also liked

Indexing Complex PostgreSQL Data Types
Indexing Complex PostgreSQL Data TypesIndexing Complex PostgreSQL Data Types
Indexing Complex PostgreSQL Data TypesJonathan Katz
 
On Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data TypesOn Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data TypesJonathan Katz
 
Postgres-XC as a Key Value Store Compared To MongoDB
Postgres-XC as a Key Value Store Compared To MongoDBPostgres-XC as a Key Value Store Compared To MongoDB
Postgres-XC as a Key Value Store Compared To MongoDBMason Sharp
 
Postgres-XC: Symmetric PostgreSQL Cluster
Postgres-XC: Symmetric PostgreSQL ClusterPostgres-XC: Symmetric PostgreSQL Cluster
Postgres-XC: Symmetric PostgreSQL ClusterPavan Deolasee
 
Distributed Postgres
Distributed PostgresDistributed Postgres
Distributed PostgresStas Kelvich
 
Postgres-XC Write Scalable PostgreSQL Cluster
Postgres-XC Write Scalable PostgreSQL ClusterPostgres-XC Write Scalable PostgreSQL Cluster
Postgres-XC Write Scalable PostgreSQL ClusterMason Sharp
 

Viewers also liked (10)

Indexing Complex PostgreSQL Data Types
Indexing Complex PostgreSQL Data TypesIndexing Complex PostgreSQL Data Types
Indexing Complex PostgreSQL Data Types
 
The strength of a spatial database
The strength of a spatial databaseThe strength of a spatial database
The strength of a spatial database
 
On Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data TypesOn Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data Types
 
Postgres clusters
Postgres clustersPostgres clusters
Postgres clusters
 
Postgres-XC as a Key Value Store Compared To MongoDB
Postgres-XC as a Key Value Store Compared To MongoDBPostgres-XC as a Key Value Store Compared To MongoDB
Postgres-XC as a Key Value Store Compared To MongoDB
 
1
11
1
 
Postgres-XC: Symmetric PostgreSQL Cluster
Postgres-XC: Symmetric PostgreSQL ClusterPostgres-XC: Symmetric PostgreSQL Cluster
Postgres-XC: Symmetric PostgreSQL Cluster
 
Distributed Postgres
Distributed PostgresDistributed Postgres
Distributed Postgres
 
Multimaster
MultimasterMultimaster
Multimaster
 
Postgres-XC Write Scalable PostgreSQL Cluster
Postgres-XC Write Scalable PostgreSQL ClusterPostgres-XC Write Scalable PostgreSQL Cluster
Postgres-XC Write Scalable PostgreSQL Cluster
 

Similar to Flexible Indexing with Postgres

Flexible Indexing with Postgres
Flexible Indexing with PostgresFlexible Indexing with Postgres
Flexible Indexing with PostgresEDB
 
Making Postgres Central in Your Data Center
Making Postgres Central in Your Data CenterMaking Postgres Central in Your Data Center
Making Postgres Central in Your Data CenterEDB
 
MySQL Performance Optimization
MySQL Performance OptimizationMySQL Performance Optimization
MySQL Performance OptimizationMindfire Solutions
 
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...Dave Stokes
 
Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)
Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)
Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)Ontico
 
Presentation interpreting execution plans for sql statements
Presentation    interpreting execution plans for sql statementsPresentation    interpreting execution plans for sql statements
Presentation interpreting execution plans for sql statementsxKinAnx
 
10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQLSatoshi Nagayasu
 
PostgreSQL Performance Problems: Monitoring and Alerting
PostgreSQL Performance Problems: Monitoring and AlertingPostgreSQL Performance Problems: Monitoring and Alerting
PostgreSQL Performance Problems: Monitoring and AlertingGrant Fritchey
 
Spark SQL Catalyst Code Optimization using Function Outlining with Kavana Bha...
Spark SQL Catalyst Code Optimization using Function Outlining with Kavana Bha...Spark SQL Catalyst Code Optimization using Function Outlining with Kavana Bha...
Spark SQL Catalyst Code Optimization using Function Outlining with Kavana Bha...Databricks
 
Introduction to Databases - query optimizations for MySQL
Introduction to Databases - query optimizations for MySQLIntroduction to Databases - query optimizations for MySQL
Introduction to Databases - query optimizations for MySQLMárton Kodok
 
Cloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure toolsCloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure toolsPushkar Chivate
 
SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"
SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"
SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"South Tyrol Free Software Conference
 
PostgreSQL 9.5 - Major Features
PostgreSQL 9.5 - Major FeaturesPostgreSQL 9.5 - Major Features
PostgreSQL 9.5 - Major FeaturesInMobi Technology
 
Query parameterization
Query parameterizationQuery parameterization
Query parameterizationRiteshkiit
 
Индексируем базу: как делать хорошо и не делать плохо Winter saint p 2021 m...
Индексируем базу: как делать хорошо и не делать плохо   Winter saint p 2021 m...Индексируем базу: как делать хорошо и не делать плохо   Winter saint p 2021 m...
Индексируем базу: как делать хорошо и не делать плохо Winter saint p 2021 m...Андрей Новиков
 
U-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersU-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersMichael Rys
 
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...PostgresOpen
 
PostgreSQL 9.5 Features
PostgreSQL 9.5 FeaturesPostgreSQL 9.5 Features
PostgreSQL 9.5 FeaturesSaiful
 
N1QL workshop: Indexing & Query turning.
N1QL workshop: Indexing & Query turning.N1QL workshop: Indexing & Query turning.
N1QL workshop: Indexing & Query turning.Keshav Murthy
 

Similar to Flexible Indexing with Postgres (20)

Flexible Indexing with Postgres
Flexible Indexing with PostgresFlexible Indexing with Postgres
Flexible Indexing with Postgres
 
Making Postgres Central in Your Data Center
Making Postgres Central in Your Data CenterMaking Postgres Central in Your Data Center
Making Postgres Central in Your Data Center
 
MySQL Performance Optimization
MySQL Performance OptimizationMySQL Performance Optimization
MySQL Performance Optimization
 
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
PHP UK 2020 Tutorial: MySQL Indexes, Histograms And other ways To Speed Up Yo...
 
Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)
Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)
Postgres в основе вашего дата-центра, Bruce Momjian (EnterpriseDB)
 
Presentation interpreting execution plans for sql statements
Presentation    interpreting execution plans for sql statementsPresentation    interpreting execution plans for sql statements
Presentation interpreting execution plans for sql statements
 
10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL
 
MySQL performance tuning
MySQL performance tuningMySQL performance tuning
MySQL performance tuning
 
PostgreSQL Performance Problems: Monitoring and Alerting
PostgreSQL Performance Problems: Monitoring and AlertingPostgreSQL Performance Problems: Monitoring and Alerting
PostgreSQL Performance Problems: Monitoring and Alerting
 
Spark SQL Catalyst Code Optimization using Function Outlining with Kavana Bha...
Spark SQL Catalyst Code Optimization using Function Outlining with Kavana Bha...Spark SQL Catalyst Code Optimization using Function Outlining with Kavana Bha...
Spark SQL Catalyst Code Optimization using Function Outlining with Kavana Bha...
 
Introduction to Databases - query optimizations for MySQL
Introduction to Databases - query optimizations for MySQLIntroduction to Databases - query optimizations for MySQL
Introduction to Databases - query optimizations for MySQL
 
Cloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure toolsCloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure tools
 
SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"
SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"
SFScon15 - Peter Moser: "The path of a query - POstgreSQL internals"
 
PostgreSQL 9.5 - Major Features
PostgreSQL 9.5 - Major FeaturesPostgreSQL 9.5 - Major Features
PostgreSQL 9.5 - Major Features
 
Query parameterization
Query parameterizationQuery parameterization
Query parameterization
 
Индексируем базу: как делать хорошо и не делать плохо Winter saint p 2021 m...
Индексируем базу: как делать хорошо и не делать плохо   Winter saint p 2021 m...Индексируем базу: как делать хорошо и не делать плохо   Winter saint p 2021 m...
Индексируем базу: как делать хорошо и не делать плохо Winter saint p 2021 m...
 
U-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersU-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for Developers
 
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
 
PostgreSQL 9.5 Features
PostgreSQL 9.5 FeaturesPostgreSQL 9.5 Features
PostgreSQL 9.5 Features
 
N1QL workshop: Indexing & Query turning.
N1QL workshop: Indexing & Query turning.N1QL workshop: Indexing & Query turning.
N1QL workshop: Indexing & Query turning.
 

More from EDB

Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
Cloud Migration Paths: Kubernetes, IaaS, or DBaaSCloud Migration Paths: Kubernetes, IaaS, or DBaaS
Cloud Migration Paths: Kubernetes, IaaS, or DBaaSEDB
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr UnternehmenDie 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr UnternehmenEDB
 
Migre sus bases de datos Oracle a la nube
Migre sus bases de datos Oracle a la nube Migre sus bases de datos Oracle a la nube
Migre sus bases de datos Oracle a la nube EDB
 
EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021EDB
 
Benchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQLBenchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQLEDB
 
Las Variaciones de la Replicación de PostgreSQL
Las Variaciones de la Replicación de PostgreSQLLas Variaciones de la Replicación de PostgreSQL
Las Variaciones de la Replicación de PostgreSQLEDB
 
NoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQLNoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQLEDB
 
Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?EDB
 
Data Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQLData Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQLEDB
 
Practical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresPractical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresEDB
 
A Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAINA Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAINEDB
 
IOT with PostgreSQL
IOT with PostgreSQLIOT with PostgreSQL
IOT with PostgreSQLEDB
 
A Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQLA Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQLEDB
 
Psql is awesome!
Psql is awesome!Psql is awesome!
Psql is awesome!EDB
 
EDB 13 - New Enhancements for Security and Usability - APJ
EDB 13 - New Enhancements for Security and Usability - APJEDB 13 - New Enhancements for Security and Usability - APJ
EDB 13 - New Enhancements for Security and Usability - APJEDB
 
Comment sauvegarder correctement vos données
Comment sauvegarder correctement vos donnéesComment sauvegarder correctement vos données
Comment sauvegarder correctement vos donnéesEDB
 
Cloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - ItalianoCloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - ItalianoEDB
 
New enhancements for security and usability in EDB 13
New enhancements for security and usability in EDB 13New enhancements for security and usability in EDB 13
New enhancements for security and usability in EDB 13EDB
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLEDB
 
Cloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJCloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJEDB
 

More from EDB (20)

Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
Cloud Migration Paths: Kubernetes, IaaS, or DBaaSCloud Migration Paths: Kubernetes, IaaS, or DBaaS
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr UnternehmenDie 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
 
Migre sus bases de datos Oracle a la nube
Migre sus bases de datos Oracle a la nube Migre sus bases de datos Oracle a la nube
Migre sus bases de datos Oracle a la nube
 
EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021EFM Office Hours - APJ - July 29, 2021
EFM Office Hours - APJ - July 29, 2021
 
Benchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQLBenchmarking Cloud Native PostgreSQL
Benchmarking Cloud Native PostgreSQL
 
Las Variaciones de la Replicación de PostgreSQL
Las Variaciones de la Replicación de PostgreSQLLas Variaciones de la Replicación de PostgreSQL
Las Variaciones de la Replicación de PostgreSQL
 
NoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQLNoSQL and Spatial Database Capabilities using PostgreSQL
NoSQL and Spatial Database Capabilities using PostgreSQL
 
Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?Is There Anything PgBouncer Can’t Do?
Is There Anything PgBouncer Can’t Do?
 
Data Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQLData Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQL
 
Practical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresPractical Partitioning in Production with Postgres
Practical Partitioning in Production with Postgres
 
A Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAINA Deeper Dive into EXPLAIN
A Deeper Dive into EXPLAIN
 
IOT with PostgreSQL
IOT with PostgreSQLIOT with PostgreSQL
IOT with PostgreSQL
 
A Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQLA Journey from Oracle to PostgreSQL
A Journey from Oracle to PostgreSQL
 
Psql is awesome!
Psql is awesome!Psql is awesome!
Psql is awesome!
 
EDB 13 - New Enhancements for Security and Usability - APJ
EDB 13 - New Enhancements for Security and Usability - APJEDB 13 - New Enhancements for Security and Usability - APJ
EDB 13 - New Enhancements for Security and Usability - APJ
 
Comment sauvegarder correctement vos données
Comment sauvegarder correctement vos donnéesComment sauvegarder correctement vos données
Comment sauvegarder correctement vos données
 
Cloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - ItalianoCloud Native PostgreSQL - Italiano
Cloud Native PostgreSQL - Italiano
 
New enhancements for security and usability in EDB 13
New enhancements for security and usability in EDB 13New enhancements for security and usability in EDB 13
New enhancements for security and usability in EDB 13
 
Best Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQLBest Practices in Security with PostgreSQL
Best Practices in Security with PostgreSQL
 
Cloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJCloud Native PostgreSQL - APJ
Cloud Native PostgreSQL - APJ
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Flexible Indexing with Postgres

  • 1. Flexible Indexing with Postgres BRUCE MOMJIAN December, 2014 Postgres offers a wide variety of indexing structures, and many index lookup methods with specialized capabilities.This talk explores the many Postgres indexing options. Includes concepts from Teodor Sigaev, Alexander Korotkov, Oleg Bartunov, Jonathan Katz Creative Commons Attribution License http://momjian.us/presentations 1 / 53
  • 2. PostgreSQL the database… ◮ Open Source Object Relational DBMS since 1996 ◮ Distributed under the PostgreSQL License ◮ Similar technical heritage as Oracle, SQL Server & DB2 ◮ However, a strong adherence to standards (ANSI-SQL 2008) ◮ Highly extensible and adaptable design ◮ Languages, indexing, data types, etc. ◮ E.g. PostGIS, JSONB, SQL/MED ◮ Extensive use throughout the world for applications and organizations of all types ◮ Bundled into Red Hat Enterprise Linux, Ubuntu, CentOS and Amazon Linux Flexible Indexing with Postgres 2 / 53
  • 3. PostgreSQL the community… ◮ Independent community led by a Core Team of six ◮ Large, active and vibrant community ◮ www.postgresql.org ◮ Downloads, Mailing lists, Documentation ◮ Sponsors sampler: ◮ Google, Red Hat, VMWare, Skype, Salesforce, HP and EnterpriseDB ◮ http://www.postgresql.org/community/ Flexible Indexing with Postgres 3 / 53
  • 4. EnterpriseDB the company… ◮ The worldwide leader of Postgres based products and services founded in 2004 ◮ Customers include 50 of the Fortune 500 and 98 of the Forbes Global 2000 ◮ Enterprise offerings: ◮ PostgreSQL Support, Services and Training ◮ Postgres Plus Advanced Server with Oracle Compatibility ◮ Tools for Monitoring, Replication, HA, Backup & Recovery Community ◮ Citizenship ◮ Contributor of key features: Materialized Views, JSON, & more ◮ Nine community members on staff Flexible Indexing with Postgres 4 / 53
  • 5. EnterpriseDB the company… Flexible Indexing with Postgres 5 / 53
  • 6. Outline 1. Traditional indexing 2. Expression indexes 3. Partial indexes 4. Benefits of bitmap index scans 5. Non-b-tree index types 6. Data type support for index types 7. Index usage summary Flexible Indexing with Postgres 6 / 53
  • 8. B-Tree ◮ Ideal for looking up unique values and maintaining unique indexes ◮ High concurrency implementation ◮ Index is key/row-pointer, key/row-pointer ◮ Supply ordered data for queries ◮ ORDER BY clauses (and LIMIT) ◮ Merge joins ◮ Nested loop with index scans Flexible Indexing with Postgres 8 / 53
  • 9. But I Want More! ◮ Index expressions/functions ◮ Row control ◮ Index non-linear data ◮ Closest-match searches ◮ Index data with many duplicates ◮ Index multi-valued fields Flexible Indexing with Postgres 9 / 53
  • 10. Expression Index SELECT * FROM customer WHERE lower(name) = ’andy’; CREATE INDEX i_customer_name ON customer (name); CREATE INDEX i_customer_lower ON customer (lower(name)); Flexible Indexing with Postgres 10 / 53
  • 11. Let’s Test It CREATE TABLE customer (name) AS SELECT ’cust’ || i FROM generate_series(1, 1000) AS g(i); SELECT 1000 CREATE INDEX i_customer_name ON customer (name); CREATE INDEX EXPLAIN SELECT * FROM customer WHERE name = ’cust999’; QUERY PLAN ------------------------------------------------------ Index Only Scan using i_customer_name on customer ... Index Cond: (name = ’cust999’::text) EXPLAIN SELECT * FROM customer WHERE lower(name) = ’cust999’; QUERY PLAN --------------------------------------------------------- Seq Scan on customer (cost=0.00..20.00 rows=5 width=7) Filter: (lower(name) = ’cust999’::text) Flexible Indexing with Postgres 11 / 53
  • 12. Create an Expression Index CREATE INDEX i_customer_lower ON customer (lower(name)); CREATE INDEX EXPLAIN SELECT * FROM customer WHERE lower(name) = ’cust999’; QUERY PLAN --------------------------------------------------------------- Bitmap Heap Scan on customer (cost=4.32..9.66 rows=5 width=7) Recheck Cond: (lower(name) = ’cust999’::text) -> Bitmap Index Scan on i_customer_lower ... Index Cond: (lower(name) = ’cust999’::text) Flexible Indexing with Postgres 12 / 53
  • 13. Other Expression Index Options ◮ User-defined functions ◮ Concatenation of columns ◮ Math expressions ◮ Only IMMUTABLE functions can be used ◮ Consider casting when matching WHERE clause expressions to the indexed expression Flexible Indexing with Postgres 13 / 53
  • 14. Partial Index: Index Row Control ◮ Why index every row if you are only going to look up some of them? ◮ Smaller index on disk and in memory ◮ More shallow index ◮ Less INSERT/UPDATE index overhead ◮ Sequential scan still possible Flexible Indexing with Postgres 14 / 53
  • 15. Partial Index Creation ALTER TABLE customer ADD COLUMN state CHAR(2); ALTER TABLE UPDATE customer SET state = ’AZ’ WHERE name LIKE ’cust9__’; UPDATE 100 CREATE INDEX i_customer_state_az ON customer (state) WHERE state = ’AZ’; CREATE INDEX Flexible Indexing with Postgres 15 / 53
  • 16. Test the Partial Index EXPLAIN SELECT * FROM customer WHERE state = ’PA’; QUERY PLAN ---------------------------------------------------------- Seq Scan on customer (cost=0.00..17.50 rows=5 width=19) Filter: (state = ’PA’::bpchar) EXPLAIN SELECT * FROM customer WHERE state = ’AZ’; QUERY PLAN ---------------------------------------------------------------------------- Bitmap Heap Scan on customer (cost=4.18..9.51 rows=5 width=19) Recheck Cond: (state = ’AZ’::bpchar) -> Bitmap Index Scan on i_customer_state_az ... Index Cond: (state = ’AZ’::bpchar) Flexible Indexing with Postgres 16 / 53
  • 17. Partial Index With Different Indexed Column DROP INDEX i_customer_name; DROP INDEX CREATE INDEX i_customer_name_az ON customer (name) WHERE state = ’AZ’; CREATE INDEX EXPLAIN SELECT * FROM customer WHERE name = ’cust975’; QUERY PLAN ---------------------------------------------------------- Seq Scan on customer (cost=0.00..17.50 rows=1 width=19) Filter: (name = ’cust975’::text) Index Cond: (state = ’AZ’::bpchar) Flexible Indexing with Postgres 17 / 53
  • 18. Partial Index With Different Indexed Column EXPLAIN SELECT * FROM customer WHERE name = ’cust975’ AND state = ’AZ’; QUERY PLAN ----------------------------------------------------- Index Scan using i_customer_name_az on customer ... Index Cond: (name = ’cust975’::text) EXPLAIN SELECT * FROM customer WHERE state = ’AZ’; QUERY PLAN ---------------------------------------------------------------- Bitmap Heap Scan on customer (cost=4.17..9.50 rows=5 width=19) Recheck Cond: (state = ’AZ’::bpchar) -> Bitmap Index Scan on i_customer_name_az ... Flexible Indexing with Postgres 18 / 53
  • 19. Benefits of Bitmap Index Scans ◮ Used when: ◮ an index lookup might generate multiple hits on the same heap (data) page ◮ using multiple indexes for a single query is useful ◮ Creates a bitmap of matching entries in memory ◮ Row or block-level granularity ◮ Bitmap allows heap pages to be visited only once for multiple matches ◮ Bitmap can merge the results from several indexes with AND/OR filtering ◮ Automatically enabled by the optimizer Flexible Indexing with Postgres 19 / 53
  • 20. Bitmap Index Scan =& Combined ’A’ AND ’NS’ 1 0 1 0 TableIndex 1 col1 = ’A’ Index 2 1 0 0 col2 = ’NS’ 1 0 1 0 0 Index Flexible Indexing with Postgres 20 / 53
  • 22. Generalized Inverted Index (GIN) ◮ Best for indexing values that can contain multiple keys, e.g. ◮ text documents ◮ JSON ◮ multi-dimensional data ◮ Also ideal for columns that contain many duplicates ◮ Key is stored only once ◮ Index is key/many-row-pointers ◮ Index updates are batched, though always checked for accuracy ◮ In Postgres 9.4 ◮ compression of row pointer list ◮ optimized multi-key filtering Flexible Indexing with Postgres 22 / 53
  • 23. Generalized Search Tree (GIST) GIST is a general indexing framework designed to allow indexing of complex data types with minimal programming. Supported data types include: ◮ geometric types ◮ range types ◮ hstore (key/value pairs) ◮ intarray (integer arrays) ◮ pg_trgm (trigrams) Supports optional “distance” for nearest-neighbors/closest matches. (GIN is also generalized.) Flexible Indexing with Postgres 23 / 53
  • 24. Space-Partitioned Generalized Search Tree (SP-GIST) ◮ Similar to GIST in that it is a generalized indexing framework ◮ Allows the key to be split apart (decomposed) ◮ Parts are indexed hierarchically into partitions ◮ Partitions are of different sizes ◮ Each child needs to store only the child-unique portion of the original value because each entry in the partition shares the same parent value. Flexible Indexing with Postgres 24 / 53
  • 25. Hash Indexes ◮ Equality, non-equality lookups; no range lookups ◮ Not crash-safe ◮ Not replicated ◮ Cannot be restored via point-in-time recovery ◮ Poor performance and concurrency characteristics ◮ Boo Flexible Indexing with Postgres 25 / 53
  • 26. I Am Not Making This Up SELECT amname, obj_description(oid, ’pg_am’) FROM pg_am ORDER BY 1; amname | obj_description --------+----------------------------- btree | b-tree index access method gin | GIN index access method gist | GiST index access method hash | hash index access method spgist | SP-GiST index access method Flexible Indexing with Postgres 26 / 53
  • 27. Data Type Support for Index Types https://www.flickr.com/photos/jonobass/ Flexible Indexing with Postgres 27 / 53
  • 28. Finding Supported Data Types - B-Tree SELECT opfname FROM pg_opfamily, pg_am WHERE opfmethod = pg_am.oid AND amname = ’btree’ ORDER BY 1; abstime_ops jsonb_ops text_ops array_ops macaddr_ops text_pattern_ops bit_ops money_ops tid_ops bool_ops name_ops time_ops bpchar_ops network_ops timetz_ops bpchar_pattern_ops numeric_ops tinterval_ops bytea_ops oid_ops tsquery_ops char_ops oidvector_ops tsvector_ops datetime_ops pg_lsn_ops uuid_ops enum_ops range_ops varbit_ops float_ops record_image_ops integer_ops record_ops interval_ops reltime_ops These data types are mostly single-value and easily ordered. B-tree support for multi-valued types like tsvector is only for complete-field equality comparisons. Flexible Indexing with Postgres 28 / 53
  • 29. Finding Supported Data Types - GIN SELECT opfname FROM pg_opfamily, pg_am WHERE opfmethod = pg_am.oid AND amname = ’gin’ ORDER BY 1; opfname ---------------- array_ops jsonb_ops jsonb_path_ops tsvector_ops These date types are multi-value, where each value is independent. Flexible Indexing with Postgres 29 / 53
  • 30. Finding Supported Data Types - GIST SELECT opfname FROM pg_opfamily, pg_am WHERE opfmethod = pg_am.oid AND amname = ’gist’ ORDER BY 1; opfname -------------- box_ops circle_ops jsonb_ops network_ops point_ops poly_ops range_ops tsquery_ops tsvector_ops These date types are multi-value — some have independent values (JSON, tsvector), others have dependent values (point, box). Flexible Indexing with Postgres 30 / 53
  • 31. Finding Supported Data Types - SP-GIST SELECT opfname FROM pg_opfamily, pg_am WHERE opfmethod = pg_am.oid AND amname = ’spgist’ ORDER BY 1; opfname ---------------- kd_point_ops quad_point_ops range_ops text_ops For text, this is useful when the keys are long. Flexible Indexing with Postgres 31 / 53
  • 33. B-Tree C Item Item Item Special< N< F >= N G Internal Leaf Page Header Item Item Item SpecialC E A Heap Page Header Item Item Item SpecialK L G M I A E P K W L Page Header Flexible Indexing with Postgres 33 / 53
  • 34. GIN Example Using tsvector_ops CREATE TABLE articles (doc TSVECTOR); CREATE TABLE INSERT INTO articles VALUES (’The fox is sick’); INSERT 0 1 INSERT INTO articles VALUES (’How sick is this’); INSERT 0 1 SELECT ctid, * FROM articles ORDER BY 1; ctid | doc -------+--------------------------- (0,1) | ’The’ ’fox’ ’is’ ’sick’ (0,2) | ’How’ ’is’ ’sick’ ’this’ Flexible Indexing with Postgres 34 / 53
  • 35. GIN Example Using tsvector_ops SELECT ctid, * FROM articles ORDER BY 1; ctid | doc -------+--------------------------- (0,1) | ’The’ ’fox’ ’is’ ’sick’ (0,2) | ’How’ ’is’ ’sick’ ’this’ fox (0,1) is (0,1), (0,2) sick (0,1), (0,2) this (0,2) How (0,2) The (0,1) Integer arrays are indexed similarly. Flexible Indexing with Postgres 35 / 53
  • 36. GIN Example Using JSON CREATE TABLE webapp (doc JSON); CREATE TABLE INSERT INTO webapp VALUES (’{"name" : "Bill", "active" : true}’); INSERT 0 1 INSERT INTO webapp VALUES (’{"name" : "Jack", "active" : true}’); INSERT 0 1 SELECT ctid, * FROM webapp ORDER BY 1; ctid | doc -------+------------------------------------ (0,1) | {"name" : "Bill", "active" : true} (0,2) | {"name" : "Jack", "active" : true} Flexible Indexing with Postgres 36 / 53
  • 37. GIN Example Using jsonb_ops (default) (0,1) | {"name" : "Bill", "active" : true} (0,2) | {"name" : "Jack", "active" : true} CREATE INDEX i_webapp_yc ON webapp USING gin (doc /* jsonb_ops */); active (0,1), (0,2) name (0,1), (0,2) true (0,1), (0,2) Bill (0,1) Jack (0,2) Flexible Indexing with Postgres 37 / 53
  • 38. GIN Example Using jsonb_path_ops (0,1) | {"name" : "Bill", "active" : true} (0,2) | {"name" : "Jack", "active" : true} CREATE INDEX i_webapp_doc_path ON webapp USING gin (doc jsonb_path_ops); hash(active, true) (0,1), (0,2) hash(name, Bill) (0,1) hash(name, Jack) (0,2) Nested keys have their parent keys (paths) prepended before hashing. Flexible Indexing with Postgres 38 / 53
  • 39. GIST ◮ Supports data types with loosely-coupled values, like tsvector, JSONB ◮ Uniquely supports data types with tightly-coupled values ◮ multi-dimensional types (geographic) ◮ range types ◮ IP network data type Flexible Indexing with Postgres 39 / 53
  • 40. Linear Indexing 0 5−5 0 5−5 0 5−5 = 2 >= 2 Flexible Indexing with Postgres 40 / 53
  • 42. Linear Methods Are Inefficient 5−5 x y x >= 2 x Flexible Indexing with Postgres 42 / 53
  • 43. R-Tree Indexes Bounding Boxes 5−5 x y x Level 1 Level 3 Level 2 Geographic objects (lines, polygons) also can appear in r-tree indexes. based on their own bounding boxes. Flexible Indexing with Postgres 43 / 53
  • 44. GIST Two-Dimensional Ops box_ops circle_ops point_ops poly_ops PostGIS also uses this indexing method. Flexible Indexing with Postgres 44 / 53
  • 45. Range Indexing With GIST GIST range type indexing uses large ranges at the top level of the index, with ranges decreasing in size at lower levels, just like how r-tree bounding boxes are indexed. Flexible Indexing with Postgres 45 / 53
  • 46. SP-GIST TEXT_OPS Example (Suffix Tree) yahoo.com/google.com/ http:// index.html maps.html index.html flickr.html cgi.html google.com/public/ berkeley.edu/ README ftp:// bin.tar.gz doc.pdf Internally split by character. B-trees use range partitioning, e.g. A-C, rather than common prefix partitioning, so a btree key must store the full key value. Flexible Indexing with Postgres 46 / 53
  • 47. Other SP-GIST Index Examples ◮ quad_point_ops uses four corner points in square partitions of decreasing size ◮ kd_point_ops splits on only one dimension Flexible Indexing with Postgres 47 / 53
  • 48. Extension Index Support ◮ btree_gin (GIN) ◮ btree_gist (GIST) ◮ cube (GIST) ◮ hstore (GIST, GIN) ◮ intarray (GIST, GIN) ◮ ltree (GIST) ◮ pg_trgm (GIST, GIN) ◮ PostGIS ◮ seg Flexible Indexing with Postgres 48 / 53
  • 50. When To Create Indexes ◮ pg_stat_user_tables.seq_scan is high ◮ Check frequently-executed queries with EXPLAIN (find via pg_stat_statements or pgbadger) ◮ Squential scans are not always bad ◮ If pg_stat_user_indexes.idx_scan is low,the index might be unnecessary ◮ Unnecessary indexes use storage space and slow down INSERTs and some UPDATEs Flexible Indexing with Postgres 50 / 53
  • 51. Evaluating Index Types ◮ Build time, INSERT/UPDATE overhead ◮ Storage size ◮ Access speed ◮ Operator lookup flexibility Flexible Indexing with Postgres 51 / 53
  • 52. Additional Resources… ◮ Postgres Downloads: ◮ www.enterprisedb.com/downloads ◮ Product and Services information: ◮ info@enterprisedb.com Flexible Indexing with Postgres 52 / 53