now() vs. 'NOW'::timestamp vs. clock_timestamp() — Ah, dates and times, the bane of any app developer’s life.. and database users too :-) This post looks at the different flavors of working with the current time in Postgres.
Hans-Jürgen Schönig
|
Who Contributed to Postgres Development in 2019? — Robert’s annual look at who contributed the most to Postgres development, if you go by lines of code added, committers of other people’s code, and participants on the pgsql-hackers list.
Robert Haas
|
The Internals of Postgres — We’ve linked it a couple of times over the years, but if Bruce Monjian hasn’t seen something, I’m going to assume many of you haven’t either. There’s a lot of gnarly stuff in here, but if you can follow even a bit of it, you’ll learn a lot about how Postgres does its business.
Hironobu SUZUKI
|
Network Latency Does Make a BIG Difference — Getting your queries as fast as possible is great, but network latency is important too. Hans-Jürgen demonstrates how to measure its impact in a situation with simulated latency.
Hans-Jürgen Schönig
|
Your Data Is Your Business — PGX is a full-service database consultancy focused on PostgreSQL data systems, on any platform or hosting environment.
PostgreSQL Experts, Inc.
|
supported by
💡 Tip of the Week
BETWEEN and BETWEEN SYMMETRIC
Let's say you have a basic people table like this:
|
If you wanted to return rows matching people with an age between (and inclusive of) 25 and 50, you could write a query like this:
|
SELECT * FROM people WHERE age >= 25 AND age <= 50;
|
So far, so good, but you can also use the BETWEEN operator to tighten things up a bit:
|
SELECT * FROM people WHERE age BETWEEN 25 and 50;
|
(Extra tip: You can use NOT BETWEEN to get the opposite effect!)
This is great and makes things very readable, but what if the values were switched around, such as BETWEEN 50 and 25 ? It won't work as the values have to be in order.
Enter BETWEEN SYMMETRIC :
|
SELECT * FROM people WHERE age BETWEEN SYMMETRIC 50 and 25;
|
This query will put the range limits in the correct order and return the relevant two rows. Do note that this is a Postgres specific extension to BETWEEN , though (mostly! - HSQLDB supports it as well) so it depends how universal you want your SQL to be :-)
This week’s tip is sponsored by Retool. Build internal tools in days, not weeks. Retool provides UI building blocks that connect to any DB and API so you can quickly build the tools your company needs.
|
|
🗓 Upcoming Online Events
-
Bruce Momjian on 'The Future of Postgres Sharding' - on May 15/16 (depending upon timezone). The first in a series of sessions being run by the China PostgreSQL Association.
-
Postgres Pulse - weekly at 11am ET each Monday. Weekly Zoom-based sessions with folks like Bruce Momjian, Vibhor Kumar, and other people at EnterpriseDB.
-
Postgres Vision 2020 on June 23-24. A full attempt at an online Postgres conference across multiple days with multiple tracks.
|
|
|