Replication between different 15.x minor versions ok?

2023-06-28 Thread David Tinker
Is it ok to use physical replication between different 15.x minor releases
(on Ubuntu 22.04)? I haven't been able to find a definitive answer. Thanks.


Postgres as a LRU cache?

2023-04-18 Thread David Tinker
Has anyone tried using Postgres as a LRU cache for data in cloud blob
storage? I have a lot of data in Cassandra and want to move that to
Backblaze (like S3 but cheaper and less available). Cassandra is working
well but I have to add new nodes more frequently that I would like. The
older data is rarely needed but newer and recently accessed records need to
be local. Everything is on leased servers at Hetzner.

I was thinking that I could use a table partitioned by created date (one
partition per day) and drop the oldest partition(s) when it starts getting
full. This wouldn’t be LRU but would probably work for my application.
create table activity_stream (activity_id text primary key,created
timestamp,last_read timestamp,data bytea  -- 1k to approx 200k,
mostly on the lower side)-- Partition would use created to split by day
I could update last_read whenever a record is read. If I use a fill factor
of less than 100 and only update last_read would I avoid dead tuple
problems with HOT tuple optimisation?Then before dropping the oldest
partition I can update created = last_read on recently read records to move
them to other partitions making it LRU. This will be a small percentage of
the data.
Any suggestions / other approaches? Thanks.


How much shared memory does Postgresql need per max_locks_per_transaction?

2020-11-30 Thread David Tinker
I have a Postgresql 10 database with about 300k tables in 23k schemas. I am
trying to upgrade to Postgresql 13 using pg_upgradecluster. This is failing
while attempting dump all the schemas:

pg_dump: error: query failed: ERROR:  out of shared memory
HINT:  You might need to increase max_locks_per_transaction.
pg_dump: error: query was: LOCK TABLE "a45119740"."activity_hrc" IN ACCESS
SHARE MODE

Is setting max_locks_per_transaction to 300k something that can be done? I
haven't been able to find anything explaining how much shared memory this
might need. The machine has 64G of RAM.

(I understand that I need to change my db design .. I have been backing up
one schema at a time until now so wasn't aware of this problem)

Thanks
David