Skip to content

Indexing on a Postgres table containing 50 million rows

Notifications You must be signed in to change notification settings

amhsirak/pg-index

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

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.

About

Indexing on a Postgres table containing 50 million rows

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published