Deploying simple indexes

Firing up more worker processes to scan ever larger tables is sometimes not the solution. Reading entire tables to find just a single row is usually not a good idea.

Therefore, it makes sense to create indexes:

test=# CREATE INDEX idx_id ON t_test (id);  
CREATE INDEX 
test=# SELECT * FROM t_test WHERE id = 43242;  id    | name -------+------  43242 | hans (1 row) Time: 0.259 ms

PostgreSQL uses Lehman-Yao's high concurrency b-tree for standard indexes. Along with some PostgreSQL specific optimizations, these trees provide end users with excellent performance. The most important thing is that Lehman-Yao allows you to run many operations (reading and writing) on the very same index at the same time, which helps to improve ...

Get Mastering PostgreSQL 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.