Re: PITR and Temp Tables

2022-04-20 Thread Huan Ruan
Many thanks for the explanation, Tom and Greg. That all makes sense. Cheers Huan

Re: PITR and Temp Tables

2022-04-20 Thread Greg Stark
There actually is a third backstop if no other session ever connects to that temp schema and cleans them out. Eventually autovacuum notices that they would need a vacuum "to prevent wraparound". It can't actually did the vacuum on temp tables but if there's no session attache

Re: PITR and Temp Tables

2022-04-20 Thread Tom Lane
Huan Ruan writes: > Let's say at T0 a database has N session based temp tables. They would have > corresponding records in the catalog tables like pg_class and pg_attribute > that are visible to other sessions. > At T1, I do a PITR to T0. That recovered database should not

Re: PITR and Temp Tables

2022-04-20 Thread Huan Ruan
Hi Patrick Thanks for your reply. > > > My guess is that temp table entries will still be in your catalog until > you do a VACUUM FULL of the pg_class / pg_attribute tables. > > But you should not care about these entries if these tables are vacuumed > at regular intervals. > What I observed in o

RE: PITR and Temp Tables

2022-04-20 Thread Patrick FICHE
From: Huan Ruan Sent: Wednesday, April 20, 2022 2:18 PM To: pgsql-general@lists.postgresql.org Subject: PITR and Temp Tables Hi All Let's say at T0 a database has N session based temp tables. They would have corresponding records in the catalog tables like pg_class and pg_attribute that

PITR and Temp Tables

2022-04-20 Thread Huan Ruan
Hi All Let's say at T0 a database has N session based temp tables. They would have corresponding records in the catalog tables like pg_class and pg_attribute that are visible to other sessions. At T1, I do a PITR to T0. That recovered database should not have those temp tables becaus

Re: Feature request (or at least discussion): enable autovaccum on temp tables

2019-05-31 Thread Michael Lewis
> > So, a related question, since we have dozens of temp tables and a lot of > code, is there a way to look up what temp tables are being created by the > current session, so I can do a VACUUM or ANALYZE on all of them in bulk? I > know I can inspect pg_temp_* schema, but how to f

Re: Feature request (or at least discussion): enable autovaccum on temp tables

2019-05-31 Thread Christopher Browne
On Fri, May 31, 2019, 12:26 PM Ivan Voras wrote: > Hi, > On Fri, 31 May 2019 at 17:43, Andrew Gierth > wrote: > >> >>>>> "Ivan" == Ivan Voras writes: >> >> Ivan> Since AFAIK temp tables are very close to unlogged ordinary >> I

Re: Feature request (or at least discussion): enable autovaccum on temp tables

2019-05-31 Thread Ivan Voras
Hi, On Fri, 31 May 2019 at 17:43, Andrew Gierth wrote: > >>>>> "Ivan" == Ivan Voras writes: > > Ivan> Since AFAIK temp tables are very close to unlogged ordinary > Ivan> tables, what would stop this feature from being implemented? > > The key d

Re: Feature request (or at least discussion): enable autovaccum on temp tables

2019-05-31 Thread Ivan Voras
hi, On Fri, 31 May 2019 at 17:54, Christopher Browne wrote: > 2. Temp tables are only associated (and visible) in the session in which > you are doing the work. autovacuum operates inside an ordinary session > context, and in a separate connected session, so it can't see your

Re: Feature request (or at least discussion): enable autovaccum on temp tables

2019-05-31 Thread Christopher Browne
On Fri, 31 May 2019 at 11:26, Ivan Voras wrote: > Hello, > > The reason why we are using temp tables is to allow concurrent runs on > some very large reports which involve creating and heavily churning dozens > of very large tables. > > The problem we're facing is

Re: Feature request (or at least discussion): enable autovaccum on temp tables

2019-05-31 Thread Andrew Gierth
>>>>> "Ivan" == Ivan Voras writes: Ivan> Since AFAIK temp tables are very close to unlogged ordinary Ivan> tables, what would stop this feature from being implemented? The key difference between temp tables and other tables is that temp table data does no

Re: Feature request (or at least discussion): enable autovaccum on temp tables

2019-05-31 Thread Ivan Voras
On Fri, 31 May 2019 at 17:38, Adam Brusselback wrote: > Temp tables are not visibile outside of a single connection, so the > autovacuum worker connection isn't able to see it. > I can connect as a superuser via psql while temp tables are being used and I can examine tables i

Re: Feature request (or at least discussion): enable autovaccum on temp tables

2019-05-31 Thread Ivan Voras
On Fri, 31 May 2019 at 17:34, Pavel Stehule wrote: > Hi > > pá 31. 5. 2019 v 17:26 odesílatel Ivan Voras napsal: > >> Hello, >> >> >> autovacuum check tables once per minute, and working on closed > transactions. Lot of times temporary tables are filled inside some batch, > and immediately some

Re: Feature request (or at least discussion): enable autovaccum on temp tables

2019-05-31 Thread Adam Brusselback
Temp tables are not visibile outside of a single connection, so the autovacuum worker connection isn't able to see it. Are you sure that it's actually an issue with accumulating dead tuples, and not an issue with bad statistics? In my processes which are heavy on temp tables, I have t

Re: Feature request (or at least discussion): enable autovaccum on temp tables

2019-05-31 Thread Pavel Stehule
Hi pá 31. 5. 2019 v 17:26 odesílatel Ivan Voras napsal: > Hello, > > The reason why we are using temp tables is to allow concurrent runs on > some very large reports which involve creating and heavily churning dozens > of very large tables. > > The problem we're faci

Feature request (or at least discussion): enable autovaccum on temp tables

2019-05-31 Thread Ivan Voras
Hello, The reason why we are using temp tables is to allow concurrent runs on some very large reports which involve creating and heavily churning dozens of very large tables. The problem we're facing is that if we DON'T use temp tables, the reports finish in a couple of hours. If we D

Temp tables and replication identities

2019-02-12 Thread Michael Lewis
I am curious about receiving an error on updating/inserting into a temp table when a replication for "all tables' is created in PG 10.6. Given temp tables are not replicated, it seems odd that an update fails unless a replication identity is defined. To reproduce, try the below code.

Re: Temp tables

2018-12-10 Thread Laurenz Albe
David G. Johnston wrote: > > and what happens to this data after completion of the transaction ? > > > > Your choice. See “on conflict” clause of create temp table command. You mean the ON COMMIT clause. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com

Re: Temp tables

2018-12-09 Thread David G. Johnston
On Sunday, December 9, 2018, bhargav kamineni wrote: > > What happens if we create and insert/update the data in TEMP tables , Does > that data really gets inserted at disk level or at buffer level > Disk > and what happens to this data after completion of the transaction ?

Temp tables

2018-12-09 Thread bhargav kamineni
Hi, What happens if we create and insert/update the data in TEMP tables , Does that data really gets inserted at disk level or at buffer level and what happens to this data after completion of the transaction ? Thanks Banu