size of attributes table is too big

2025-03-25 Thread Siraj G
Hello! I have a PG (v16) instance which is occupying around 1TB of storage. Out of this, around 350GB is occupied by the table pg_catalog.pg_attribute. Why is the catalog table's size so big? Here are the sizes: pg_attribute 338 GB pg_attribute_relid_attnam_index 117 GB pg_attribute_relid_attnum

Re: How to pass a list of locations (longitude, latitude) to a PostgreSQL/PostGIS stored function?

2025-03-25 Thread Tony Shelver
On Tue, 25 Mar 2025 at 19:07, Tom Lane wrote: > Alexander Farber writes: > > Then I am trying to add a function, which would receive a series of > > locations (longitude and latitude pairs in microdegrees) and return a > list > > of lowercase 2-letter country codes, like "de", "pl", "lv": > > >

Re: Replication slot WAL reservation

2025-03-25 Thread Christophe Pettus
> On Mar 25, 2025, at 20:56, Phillip Diffley wrote: > > Is there a message type that is used to confirm what logs have been > successfully consumed? You're looking for Standby Status Update: https://www.postgresql.org/docs/current/protocol-replication.html#PROTOCOL-REPLICATION-STAN

Re: Replication slot WAL reservation

2025-03-25 Thread Phillip Diffley
> You shouldn't need to manually advance the replication slot. > The client is also expected to send back regular messages letting the publisher / primary know that it has successfully consumed up to a particular point I was thinking of these as the same thing, but it sounds like they are differen

Re: Q on SELECT column list pushdown from view to table

2025-03-25 Thread Tom Lane
Karsten Hilbert writes: > I expected this: > set role "restricted-role"; > -- this works: > select public_col from t_partially_private; > -- this fails: with "permission denied on table t_partially_private" > select public_col from v_partially_private; > to work but

Q on SELECT column list pushdown from view to table

2025-03-25 Thread Karsten Hilbert
Dear all, given this schema and role: create table t_partially_private ( public_col text, private_col text ); insert into t_partially_private (public_col, private_col) values ('public value', 'private value'); create view v_partia

Re: Replication slot WAL reservation

2025-03-25 Thread Phillip Diffley
Oh I see! I was conflating the data I see coming out of a replication slot with the internal organization of the WAL. I think the more specific question I am trying to answer is, as a consumer of a replication slot, how do I reason about what replication records will be made unavailable when I conf

Re: How to pass a list of locations (longitude, latitude) to a PostgreSQL/PostGIS stored function?

2025-03-25 Thread Thiemo Kellner
El 25-03-25 a las 18:58, Christoph Berg escribió: Re: Tom Lane You might be best advised to create a composite type like "location (long bigint, lat bigint)" and use an array of that. Or use the geometry types from PostGIS, since you are probably going to do geo lookups on these points anyway

Re: Replication slot WAL reservation

2025-03-25 Thread Christophe Pettus
Missed this question! > On Mar 25, 2025, at 09:56, Phillip Diffley wrote: > But when processing data from a replication slot, we confirm rows that have > been processed and can be deleted from the WAL based on the LSN (eg. with > pg_replication_slot_advance). How does postgres identify what par

Re: How to pass a list of locations (longitude, latitude) to a PostgreSQL/PostGIS stored function?

2025-03-25 Thread Christoph Berg
Re: Tom Lane > You might be best advised to create a composite > type like "location (long bigint, lat bigint)" and use an array of > that. Or use the geometry types from PostGIS, since you are probably going to do geo lookups on these points anyway. Christoph

Re: Replication slot WAL reservation

2025-03-25 Thread Christophe Pettus
> On Mar 25, 2025, at 09:56, Phillip Diffley wrote: > 1. Every DML operation (insert, update, delete, truncate) will have a row in > the WAL and that row will have an LSN assigned to it. > 2. The LSNs are assigned when the operation happens. > 3. Operations within a transaction are written to

Re: How to pass a list of locations (longitude, latitude) to a PostgreSQL/PostGIS stored function?

2025-03-25 Thread Tom Lane
Alexander Farber writes: > Then I am trying to add a function, which would receive a series of > locations (longitude and latitude pairs in microdegrees) and return a list > of lowercase 2-letter country codes, like "de", "pl", "lv": > CREATE OR REPLACE FUNCTION find_countries(locations BIGIN

Re: Experience and feedback on pg_restore --data-only

2025-03-25 Thread Adrian Klaver
On 3/24/25 09:15, Dimitrios Apostolou wrote: Hi Ron, I read your reply in the mailing list archives as I'm not subscribed to the list, and I'm copy-pasting a response here. Please include me as a recipient in further replies. Why are you regularly having emergencies requiring the restoration o

How to pass a list of locations (longitude, latitude) to a PostgreSQL/PostGIS stored function?

2025-03-25 Thread Alexander Farber
Hello dear PostgreSQL users I have prepared a https://dbfiddle.uk/vOFXNgns for my question and also list my SQL code below. I have created a countires_boundaries table, which I intend to fill with .poly files provided at Geofabrik: CREATE EXTENSION IF NOT EXISTS postgis; CREATE TABLE I

Re: size of attributes table is too big

2025-03-25 Thread Ron Johnson
Use "pg_repack" instead. It's an "online" CLUSTER / VACUUM FULL replacement that's in both RPM and apt repos. On Tue, Mar 25, 2025 at 12:36 AM Siraj G wrote: > Thank you! > > I noticed over 99% free space. Now the challenge is running FULL VACUUM on > a table with size over 500GB. It is going t