Postgres: Digging into queries

I got through some more postgres documentation today. I think reading docs can only hold my concentration for 1-2 hours max. Today I learned some formal definitions of some postgres functionality that I’m familiar with, such as joins, groupings, and the select list. Some new concepts for me were the GROUPING SETS, the ROLLUP, and the CUBE. These are essentially shortcuts to do complex groupings. Grouping sets allows you to do display multiple groupings within the same result set, a rollup lets you iteratively remove a column from a grouping set, and a cube takes the power set groupings from a group set. Off the top of my head, I can’t think of anywhere that these would’ve been useful for me in the past, but at least I know they exist.

The WITH clause, including the RECURSIVE option, are terms I’ve seen before, but have always been a little intimidated by, since they aren’t as intuitive as the simpler statements. I got a brief overview of them, and it seems like the WITH is something I could make use of (not so much the RECURSIVE), but I will definitely need some hands-on practice before feeling confident with it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s