My PostgreSQL query went from 57ms to 1.4ms on a 1 million + row table. I didn't change the query. Here's what I did. (opens in new tab)
# My PostgreSQL query went from 57ms to 1.4ms on a 1 million + row table. I didn't change the query. Here's what I did. * * * I was debugging a slow query on a users table with 1 million rows. EXPLAIN ANALYZE showed 57ms. I ran one SQL statement — didn't touch the query, didn't change the schema logic — and it dropped to 1.4ms. That one statement was an index. But knowing where to add it, and when to stop, is what most posts don't cover. This one does. Most developers discover indexes the ...
Read the original article