Quantcast
Channel: Looking for ways to optimize sql query with inner join - Database Administrators Stack Exchange
Browsing index pages (3 articles)

Looking for ways to optimize sql query with inner join

My join query seems to be using the right index but is still slow. I am not sure where the issue lies and would appreciate any tips. The query and its explain is as follows:SELECT events.*,...

View Article


Answer by Evan Carroll for Looking for ways to optimize sql query with inner...

Your statistics are way off.In the scan on index_event_subscriptions_on_user_id_group_id it estimates 4 rows returned, yet 7295 are returned.WHERE (event_subscriptions.user_id = 456) AND...

View Article


Answer by jjanes for Looking for ways to optimize sql query with inner join

The estimateThe estimate on event_subscriptions is way off. My guess is that almost every subscription by user_id = 456 also satisfies group_id IN (123, 321, 222, 333), while PostgreSQL's planner...

View Article
Browsing index pages (3 articles)


Latest Images