An open API service indexing awesome lists of open source software.

https://github.com/amhsirak/pg-index

Indexing on a Postgres table containing 50 million rows
https://github.com/amhsirak/pg-index

database db-index indexing postgresql sql

Last synced: 6 months ago
JSON representation

Indexing on a Postgres table containing 50 million rows

Awesome Lists containing this project

README

          

### What is this?
Simple experiment to apply database indexing to improve query performance for a hypothetical `customer` table containing 50 million rows. Partial Index is created on `country` column, containing two distinct values - 'India' & 'United Kingdom'

### Test Environment
- PostgreSQL 13
- PgAdmin 4
- Windows 11 HSL (AMD Ryzen 5)

### Results

For the query `SELECT * FROM customers WHERE country='United Kingdom';`

Using `EXPLAIN ANALYZE` query for obtaining actual run-time statistics on the required statement before and after indexing.

- Query Execution Time without index: 41836.270 ms
- Query Execution Time with index: 24254.644 ms
- Improvement in query execution time ~42.03%

Related article can be found here.