PostgreSQL yesterday, today, tomorrow, now

PostgreSQL example – yesterday, today, tomorrow, now select TIMESTAMP ‘yesterday’; 2016-05-05 00:00:00 select DATE ‘yesterday’; 2016-05-05 select TIME ‘allballs’; 00:00:00 You can use similar convenient method for today and tomorrow: select TIMESTAMP ‘today’, DATE ‘today’; select TIMESTAMP ‘tomorrow’, DATE ‘tomorrow’; select now(), TIMESTAMP ‘now’, DATE ‘now’; BTW: what is ‘allballs’? It’s used to denote midnight UTC, someone ...

PostgreSQL execution plan explained

PostgreSQL execution plan explained
Recently I ran into slow query problem in our PostgreSQL database, after doing some research, I found those tips are pretty good. Just shared here: 1. Run “Explain [analyze] your SQL statement” The ANALYZE option causes the statement to be actually executed, not only planned. For more details, check PostgreSQL official ‘explain’ document: http://www.postgresql.org/docs/current/static/sql-explain.html 2. Look for “seq scan” in ...