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
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help