Postgres Insider Terminology
crunchydata.com
crunchydata.com
Anyone know if this is still true?
* Except, maybe, toast, hot or compressed..
...that uses fixed sized pages.
sounds like could be one of those rule-proving exceptions, even if it is a big facebook project
I have built a database engine that is a columnar store. All the values for each column are stored together. This requires just about every query to fetch each row value separately, but it has proven to be incredibly fast. Queries on big tables run several times faster than on Postgres and it is also about 5x faster than on SQLite. https://www.youtube.com/watch?v=Va5ZqfwQXWI
There are tons of ways to mitigate the problem including variable-length data, out-of-line storage, and compression. Postgres does those things, but I suppose there's always room to improve.
Best to just see how much storage a given table uses, and see if it's a problem.
Likely no impact, but we use Postgres in Docker on unprivileged LXC, the `/data` directory is mounted from the LXC from the host ZFS pool. Since LXC runs all processes on the host, the performance impact is negligible (unlike, e.g. running this in a full VM).
I have the _feeling_ (not actually tested) that the Postgres database is faster with ZFS, since less data needs to be read, especially since we have a lot of sequential scans.
> LZ4 is lossless compression algorithm, providing compression speed > 500 MB/s per core (>0.15 Bytes/cycle). It features an extremely fast decoder, with speed in multiple GB/s per core (~1 Byte/cycle).
So yeah, you have to either shrink to a size acceptable within padding, or pick a more appropriate page size, or play with some TOAST settings in the case of PG.
So unless you are using the sql result verbatim as presentation layer, is there any big benefit of this? On the contrary it seems like yet another moving part one could mess up and accidentally convert time where it shouldn’t?
First off, it's regrettable that Postgres drivers are parsing strings at all. That opens this can of worms.
Secondly, the DB locale setting is weird. It's advisable to always set your Postgres config to UTC locale to eliminate this nonsense, but that's not the default. So if your database is on PST, at least timestamptz will output strings that tell your code the correct time zone.
PST database:
select now() as timestamptz; -- 2022-11-09T14:41:12.110-08
select now() as timestamp; -- 2022-11-09T14:41:12.110
UTC database:
select now() as timestamptz; -- 2022-11-09T22:41:12.110Z, "Z" means UTC
select now() as timestamp; -- 2022-11-09T22:41:12.110
This isn't clearly explained in the official docs, btw. I think the only thing saving a lot of users is how AWS, GCP, etc all set their Postgres instances to UTC by default. Which makes this even more of a landmine if you ever use a DB not configured this way.
Another moral of the story is, every string representation of a datetime has a time zone, so it's better to be explicit about it. Something like "2022-11-09T14:41:12.110" is ambiguous. Put the "+00" or the "Z" if you mean UTC. Unix timestamps, on the other hand, are simply defined as a duration of time that has passed since the epoch and have no concept of time zone (don't even call them UTC).
tl;dr Just say no to `timestamp`
I think you also need it for converting input at specified time zones, which is more complicated than one might hope, using AT TIME ZONE.
So the point is about conversion, which is important, but I agree that it’s non-obvious that you need to store the source time zone separately if you ever want to retrieve it.
[0]: https://www.postgresql.org/docs/current/datatype-datetime.ht...
Super annoying.