What is LATERAL, what is it for, and how can one use it?

Lately in couple of places I recommended people that they can solve their problem with queries using LATERAL. In some cases recipient of such suggestion indicated that they had no idea what LATERAL is. Which made me think that it might be good idea to write more about them (lateral queries)… Also – I know … Continue reading “What is LATERAL, what is it for, and how can one use it?”

How to get list of elements from multiranges?

So, some time ago, Pg devs added multi ranges – that is datatype that can be used to store multiple ranges in single column. The thing is that it wasn’t really simple how to get list of ranges from within such multirange. There was no operator, no way to split it. A month ago Alexander … Continue reading “How to get list of elements from multiranges?”

Which tables should be auto vacuumed or auto analyzed?

Recently I was in a situation where autovacuum couldn’t keep up with changes. To solve the problem I finally decided to manually vacuum analyze all tables (manual vacuum/analyze is faster than one ran by autovacuum daemon). But it irritated me that I didn’t have ready way to check which tables are waiting for autovacuum to … Continue reading “Which tables should be auto vacuumed or auto analyzed?”