Using FOREIGN TABLE to get the Size of the Actual Remote Table Behind it

2022-01-13 Thread Avi Weinberg
Hi Experts, Is it possible to get the size of the table a foreign table is pointing to (without creating another connecting to the remote server)? Obviously this "select pg_size_pretty(pg_total_relation_size('f_table'))" returns 0. Thanks! IMPORTANT - This email and any attachments is intende

How can a Postgres SQL script be automatically run when a new table turns up?

2022-01-13 Thread Shaozhong SHI
When a user load a new table in the Postgres System? Can a script automatically detect it and run? Regards, David

Re: How can a Postgres SQL script be automatically run when a new table turns up?

2022-01-13 Thread Jayadevan M
When a user load a new table in the Postgres System? Can a script > automatically detect it and run? > > Are you looking for Even triggers? https://www.postgresql.org/docs/current/event-triggers.html Regards, Jay

Re: How can a Postgres SQL script be automatically run when a new table turns up?

2022-01-13 Thread Shaozhong SHI
Hi, Jay, That looks interesting. Is there an excellent example to do the following? How to create an event trigger in Postgres? When a user finished loading a new table on to it, the trigger can start off an script 10 minutes after the event? Regards, David On Thu, 13 Jan 2022 at 10:50, Jaya

Re: Using FOREIGN TABLE to get the Size of the Actual Remote Table Behind it

2022-01-13 Thread Laurenz Albe
On Thu, 2022-01-13 at 09:49 +, Avi Weinberg wrote: > Is it possible to get the size of the table a foreign table is pointing to > (without creating > another connecting to the remote server)?  Obviously this "select > pg_size_pretty(pg_total_relation_size('f_table'))" returns 0. No, there is

Assistance with an out of shared memory error

2022-01-13 Thread Gautam Bellary
Hi Postgres group, I'm reaching out for some help with an "ERROR: out of shared memory. HINT: You might need to increase max_locks_per_transaction" issue: I've got a PL/pgSQL function (regenerate_gateway_last_seen, attached) that loops through all partitions of 2 tables ("Measure" and "ValuelessM

Re: Assistance with an out of shared memory error

2022-01-13 Thread Tom Lane
Gautam Bellary writes: > I've got a PL/pgSQL function (regenerate_gateway_last_seen, attached) that > loops through all partitions of 2 tables ("Measure" and "ValuelessMeasure", > schema attached) selecting data from each into another table > ("GatewayLastSeenNew"). Occasionally the function runs

Re: How can a Postgres SQL script be automatically run when a new table turns up?

2022-01-13 Thread David G. Johnston
On Thu, Jan 13, 2022 at 8:55 AM Shaozhong SHI wrote: > That looks interesting. Is there an excellent example to do the following? > > How to create an event trigger in Postgres? When a user finished loading > a new table on to it, the trigger can start off an script 10 minutes after > the event