Re: Sort question - Fractions, Metric etc

2021-08-15 Thread Pól Ua Laoínecháin
> I have a table with metric, imperial, fraction columns. Have "metric_equivalent_magnitude" and "metric_equivalent_unit" columns and do all your sorting &c. via those columns. Use the relatively new generated (or computed/calculated) columns to calculate these. That way, you get the conversion c

Using a TRIGGER with window functions.

2021-08-15 Thread Pól Ua Laoínecháin
Hi all, I have a rather contrived example, but I just can't get this to work. A fiddle with all my code is available here: https://dbfiddle.uk/?rdbms=postgres_12&fiddle=9a89ea79ffc617a11c36d63123d2f987 CREATE TABLE t1 ( user_id SMALLINT NOT NULL, activity_id SMALLINT NOT NULL, sort_or

[no subject]

2021-08-15 Thread otar shavadze
How measure table total pages (block) count? would be this correct way? : SELECT pg_table_size('my_table'::regclass) / current_setting('block_size')::BIGINT;

Re:

2021-08-15 Thread Michael Goldberg
On Sun, Aug 15, 2021 at 12:49 PM otar shavadze wrote: > How measure table total pages (block) count? would be this correct way? : > > SELECT pg_table_size('my_table'::regclass) / > current_setting('block_size')::BIGINT; > > Did you try: SELECT relpages FROM pg_class WHERE relname='my_table'; B

Re:

2021-08-15 Thread otar shavadze
Thank you. On Sun, Aug 15, 2021 at 2:15 PM Michael Goldberg wrote: > > On Sun, Aug 15, 2021 at 12:49 PM otar shavadze > wrote: > >> How measure table total pages (block) count? would be this correct way? >> : >> >> SELECT pg_table_size('my_table'::regclass) / >> current_setting('block_size')

Single mater replica setup for an existing DB

2021-08-15 Thread Digimer
Hi all,   Could I get recommendations on how to convert an existing database to a single-master replica setup?   I'm running on RHEL 8 (pgsql version 10.17). I'd like to replicate the existing database to 1 (maybe 2) other hosts, synchronously ideally thou

Re:

2021-08-15 Thread David Rowley
On Sun, 15 Aug 2021 at 22:15, Michael Goldberg wrote: > > > On Sun, Aug 15, 2021 at 12:49 PM otar shavadze wrote: >> >> How measure table total pages (block) count? would be this correct way? : >> >> SELECT pg_table_size('my_table'::regclass) / >> current_setting('block_size')::BIGINT; > > Did

RE: ERROR: invalid memory alloc request size when committing transaction

2021-08-15 Thread Michael Harris
Thanks Simon Setting wal_level to minimal has indeed allowed it to work. Thanks for the suggestion! We aren't easily able to change the number of partitions - it consists of a large number of partitioned tables each having a reasonable number of partitions, but they multiply up to a huge numbe