3 ms·
Came here to say exactly this. Over the last 12~ years working with PostgreSQL I've dealt with quite a few performance related issues - almost all were poorly w
by smcleod 4y ago
Came here to say exactly this. Over the last 12~ years working with PostgreSQL I've dealt with quite a few performance related issues - almost all were poorly written queries.
- bakuninsbart 4y agoCan you point to some good resources on how to write better postgres queries? Or give examples of common pitfalls?
- lordnacho 4y agoI would guess the most common pitfall is either not having indices or having the wrong kind of index for your query.
- Ialdaboth 4y agoAn old classic but too many indices can be harmful too.
- Zanfa 4y agoI don't have any other good recommendations other than learning how to read and use EXPLAIN [1]. This should typically be the first tool when you have a slow query. [1] https://www.postgresql.org/docs/current/sql-explain.html https://www.postgresql.org/docs/current/sql-explain.html
- bbojan 4y agoStart with EXPLAIN ANALYZE then work from there. You can use tools where you paste the output of it and it shows you the data in a more easy to understand format.
- vberg 4y agoI am using https://explain.dalibo.com/ https://explain.dalibo.com/ for that exact purpose and it does a great job highlighting the perfs issues.
- deleted 4y ago[deleted]
- branko_d 4y agohttps://use-the-index-luke.com/ https://use-the-index-luke.com/