Re: [GENERAL] temporary tables are logged somehow?

2015-01-22 Thread Andrey Lizenko
It means, that 8192 commits + 8192 "create temp table" (and drop it after closing connection) costs me 48 MB of WAL files. And there is no way to reduce disk space usage, right? Does amount of data which has to be written to WAL-file depend on size of transaction? On 22 January 2015 at 18:44, Tom

Re: [GENERAL] temporary tables are logged somehow?

2015-01-22 Thread Tom Lane
Michael Paquier writes: > On Thu, Jan 22, 2015 at 11:06 PM, Andrey Lizenko wrote: >> 3. They are not WAL-logged. >> Whats wrong with it in my case? > Nothing. Temporary tables are not WAL-logged, but transaction commit is. Right. I think there is some optimization for transactions that only wr

Re: [GENERAL] temporary tables are logged somehow?

2015-01-22 Thread Andrey Lizenko
Why unlogged tables behaviour is not the same? If I try this: > create unlogged table if not exists positiontemporarytable > (pos_instrument_id integer, pos_code varchar(40)); > prepare pos_delete as delete from "positiontemporarytable"; > execute pos_delete; no WAL files created at all. On 22

Re: [GENERAL] temporary tables are logged somehow?

2015-01-22 Thread Adrian Klaver
On 01/22/2015 06:06 AM, Andrey Lizenko wrote: Hello all, I have a problem with growing WAL-files populating a temporary table. After running the following script 8192 times (each in separate connection) I can see 3*16 MB WAL files. 3 * 16 = 48MB Say each row takes 10 bytes(an underestimate).

Re: [GENERAL] temporary tables are logged somehow?

2015-01-22 Thread Michael Paquier
On Thu, Jan 22, 2015 at 11:06 PM, Andrey Lizenko wrote: >> 3. They are not WAL-logged. > Whats wrong with it in my case? Nothing. Temporary tables are not WAL-logged, but transaction commit is. -- Michael -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to

[GENERAL] temporary tables are logged somehow?

2015-01-22 Thread Andrey Lizenko
Hello all, I have a problem with growing WAL-files populating a temporary table. After running the following script 8192 times (each in separate connection) I can see 3*16 MB WAL files. CREATE TEMP TABLE IF NOT EXISTS positiontemporarytable (pos_instrument_id > integer, pos_code varchar(40)); >

Re: [GENERAL] Temporary Tables and Web Application

2008-06-06 Thread Tim Tassonis
Tomasz Ostrowski wrote: On 2008-06-06 07:25, Brent Wood wrote: Would "real" tables in a tablespace defined on a ramdisk meet this need? Bad idea. This would mean an unusable database after a restart. Funnily, I was thinking the same this night, somehow defining a tablespace on tmpfs or som

Re: [GENERAL] Temporary Tables and Web Application

2008-06-06 Thread Tomasz Ostrowski
On 2008-06-06 07:25, Brent Wood wrote: > Would "real" tables in a tablespace defined on a ramdisk meet this > need? Bad idea. This would mean an unusable database after a restart. > You could also mount a tablespace on a physical disk with a > filesystem which has delayed/deferred writes to disk

Re: [GENERAL] Temporary Tables and Web Application

2008-06-05 Thread Brent Wood
Hi Tim, Off the top of my head, from somewhat left field, using filesystems to manage this sort of effect. Would "real" tables in a tablespace defined on a ramdisk meet this need? So the functionality/accessibility of a physical table is provided, along with the performance of a filesystem act

Re: [GENERAL] Temporary Tables and Web Application

2008-06-05 Thread Marco Bizzarri
On Thu, Jun 5, 2008 at 5:36 PM, Tim Tassonis <[EMAIL PROTECTED]> wrote: > Is there a way to create temporary tables in another way, so they are > visible between sessions, or do I need to create real tables for my purpose? > And is the perfomance penalty big for real tables, as they have been writ

Re: [GENERAL] Temporary Tables and Web Application

2008-06-05 Thread Tim Tassonis
Tino Wildenhain wrote: Hi, Tim Tassonis wrote: Hi all I assume this is not an uncommon problem, but so far, I haven't been able to find a good answer to it. I've got a table that holds log entries and fills up very fast during the day, it gets approx. 25 million rows per day. I'm now build

Re: [GENERAL] Temporary Tables and Web Application

2008-06-05 Thread Bill Moran
In response to Tim Tassonis <[EMAIL PROTECTED]>: > > Bill Moran wrote: > > In response to Tim Tassonis <[EMAIL PROTECTED]>: > > > >> > >> Now, with apache/php in a mpm environment, I have no guarantee that a > >> user will get the same postgresql session for a subsequent request, thus > >> he w

Re: [GENERAL] Temporary Tables and Web Application

2008-06-05 Thread Tino Wildenhain
Hi, Tim Tassonis wrote: Hi all I assume this is not an uncommon problem, but so far, I haven't been able to find a good answer to it. I've got a table that holds log entries and fills up very fast during the day, it gets approx. 25 million rows per day. I'm now building a web application u

Re: [GENERAL] Temporary Tables and Web Application

2008-06-05 Thread Bill Moran
In response to Tim Tassonis <[EMAIL PROTECTED]>: > Hi all > > I assume this is not an uncommon problem, but so far, I haven't been > able to find a good answer to it. > > I've got a table that holds log entries and fills up very fast during > the day, it gets approx. 25 million rows per day. I

[GENERAL] Temporary Tables and Web Application

2008-06-05 Thread Tim Tassonis
Hi all I assume this is not an uncommon problem, but so far, I haven't been able to find a good answer to it. I've got a table that holds log entries and fills up very fast during the day, it gets approx. 25 million rows per day. I'm now building a web application using apache/mod_php where

[GENERAL] temporary tables, pgAdminIII

2006-01-16 Thread Zlatko Matić
In Postgres 8.1.1, Win XP, I tried to create some temporary tables by using pgAdmin. For example, I executed : CREATE TEMP TABLE privremena() INHERITS (plants)WITHOUT OIDSTABLESPACE pg_default;ALTER TABLE privremena OWNER TO matalab;   Although query was successfully executed, I just can't f

Re: [GENERAL] Temporary tables

2006-01-13 Thread Michael Fuhr
On Fri, Jan 13, 2006 at 05:23:42PM -, Raymond O'Donnell wrote: > The first time I call "select testfunc();", I get 0 as expected. > However, subsequent calls return an error: > > ERROR: relation with OID 80845 does not exist > CONTEXT: SQL statement "SELECT count(*) from TestTbl" > PL/pgSQ

[GENERAL] Temporary tables

2006-01-13 Thread Raymond O'Donnell
Hi all, When you create a temporary table using the CREATE TEMPORARY TABLE AS... syntax, does the table get created (but left empty) if the query returns no rows? I'm seeing funny behaviour, and don't know whether it's my incomplete understanding or whether something weird really is happening.

Re: [GENERAL] temporary tables

2005-11-09 Thread Richard Huxton
Orhan wrote: The PostgreSQL docs say that "Temporary tables are automatically dropped at the end of a session, or optionally at the end of the current transaction." If I create a temporary table through a java.sql.Statement and then call close() on that Statement, will the temporary table be drop

[GENERAL] temporary tables

2005-11-09 Thread Orhan
The PostgreSQL docs say that "Temporary tables are automatically dropped at the end of a session, or optionally at the end of the current transaction." If I create a temporary table through a java.sql.Statement and then call close() on that Statement, will the temporary table be dropped? In other w

Re: [GENERAL] temporary tables ?

2005-07-24 Thread Zlatko Matic
Thanks for explaination. Zlatko - Original Message - From: "Sean Davis" <[EMAIL PROTECTED]> To: "Zlatko Matic" <[EMAIL PROTECTED]> Cc: "pgsql list" Sent: Sunday, July 24, 2005 1:27 AM Subject: Re: [GENERAL] temporary tables ? Wh

Re: [GENERAL] temporary tables ?

2005-07-23 Thread Sean Davis
What is the influence on database growing in comparrison to permanent table frequently inserted/deleted rows ? The tables are dropped automatically after the connection is closed. The database doesn't grow because of temporary tables. As for comparison to a frequently inserted/deleted ta

Re: [GENERAL] temporary tables ?

2005-07-23 Thread Zlatko Matic
uly 22, 2005 8:06 PM Subject: Re: [GENERAL] temporary tables ? On Jul 22, 2005, at 1:55 PM, Zlatko Matic wrote: Hello. I have some tables that are updated by several users in the same time and are used in queries for reports. Those tables have rows that are actualy copied from original tab

Re: [GENERAL] temporary tables ?

2005-07-22 Thread Tony Caduto
They can also be set to drop with ON COMMIT DROP, this way they disappear after the tranaction is commited. I use them in this way on my web server to sort file listings, and it works well since each apache DSO connection gets one connection to the database. Tony http://www.amsoftwaredesign

Re: [GENERAL] temporary tables ?

2005-07-22 Thread Sean Davis
On Jul 22, 2005, at 1:55 PM, Zlatko Matic wrote: Hello. I have some tables that are updated by several users in the same time and are used in queries for reports. Those tables have rows that are actualy copied from original tables that are not to be altered. There is a procedure that insert

[GENERAL] temporary tables ?

2005-07-22 Thread Zlatko Matic
Hello. I have some tables that are updated by several users in the same time and are used in queries for reports. Those tables have rows that are actualy copied from original tables that are not to be altered. There is a procedure that inserts rows for every user when connects, along with his

Re: [GENERAL] Temporary Tables

2005-04-01 Thread Scott Marlowe
On Fri, 2005-04-01 at 04:32, Alban Hertroys wrote: > Joseph M. Day wrote: > > Just out of curiosity, what is the performance of this? In MSSQL the > > only way to do something equivalent to this was to use a cursor. Cursors > > are painfully slow, so they are to be used as a last resort. > > On

Re: [GENERAL] Temporary Tables

2005-04-01 Thread Alban Hertroys
Joseph M. Day wrote: Just out of curiosity, what is the performance of this? In MSSQL the only way to do something equivalent to this was to use a cursor. Cursors are painfully slow, so they are to be used as a last resort. On what do you base that cursors are slow? -- Alban Hertroys

Re: [GENERAL] Temporary Tables

2005-03-31 Thread tony_caduto
freshing the cached objects. > > From: "Joseph M. Day" <[EMAIL PROTECTED]> > Date: 2005/03/31 Thu AM 11:25:02 EST > To: <[EMAIL PROTECTED]>, > Subject: Re: [GENERAL] Temporary Tables > > Thanks, I thought there might be a way to force it not to do this. >

Re: [GENERAL] Temporary Tables

2005-03-31 Thread tony_caduto
NGUAGE 'plpgsql' VOLATILE > > From: "Joseph M. Day" <[EMAIL PROTECTED]> > Date: 2005/03/31 Thu AM 10:49:37 EST > To: > Subject: [GENERAL] Temporary Tables > > I am having some problems understanding how the temp tables work in PG. > I have a relat

Re: [GENERAL] Temporary Tables

2005-03-31 Thread Joseph M. Day
PROTECTED]; pgsql-general@postgresql.orgSubject: Re: [GENERAL] Temporary Tables Depending on your need, I think you could use the structure : FOR-IN-EXECUTE     http://www.postgresql.org/docs/8.0/interactive/plpgsql-control-structures.html#PLPGSQL-RECORDS-ITERATING   Tell us

Re: [GENERAL] Temporary Tables

2005-03-31 Thread Patrick . FICHE
ECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Joseph M. DaySent: jeudi 31 mars 2005 18:25To: [EMAIL PROTECTED]; pgsql-general@postgresql.orgSubject: Re: [GENERAL] Temporary Tables Thanks, I thought there might be a way to force it not to do this.   So I guess for my example I am goi

Re: [GENERAL] Temporary Tables

2005-03-31 Thread Joseph M. Day
PROTECTED] Sent: Thursday, March 31, 2005 10:06 AMTo: [EMAIL PROTECTED]; pgsql-general@postgresql.orgSubject: RE: [GENERAL] Temporary Tables   You can find this in the FAQ 4.26) Why can't I reliably create/drop temporary tables in PL/PgSQL functions? PL/PgSQL c

Re: [GENERAL] Temporary Tables

2005-03-31 Thread Richard Huxton
Joseph M. Day wrote: Nothing special about it other than "tmp_tblJoin" is defined as a temporary table. I do understand what is happening (I think). There is a stale pointer to the previous instance of the temp table (that no longer exists) which is causing the function to blow up. My question is

Re: [GENERAL] Temporary Tables

2005-03-31 Thread Patrick . FICHE
6 18 --- -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Joseph M. DaySent: jeudi 31 mars 2005 17:50To: pgsql-general@postgresql.orgSubject: [GENERAL] Temporary Tables I am having some problems understanding how the temp tables wo

[GENERAL] Temporary Tables

2005-03-31 Thread Joseph M. Day
Title: Message I am having some problems understanding how the temp tables work in PG. I have a relatively lengthy function I am creating that makes frequent use of temporary tables.   I am dropping and recreating the temp tables on each run. If I run the procedure the first time via psql i

Re: [GENERAL] Temporary tables privileges

2005-03-14 Thread Bruce Momjian
Alejandro D. Burne wrote: > Thanks Bruce, then how can I grant an user to create tmp tables and > drop then it, without gives him global drop priv (I can't grant drop > priv for the tmp table because don't exist yet) Perhaps you need a SECURITY DEFINER function. You can set the permissions on the

Re: [GENERAL] Temporary tables privileges

2005-03-14 Thread Alejandro D. Burne
Thanks Bruce, then how can I grant an user to create tmp tables and drop then it, without gives him global drop priv (I can't grant drop priv for the tmp table because don't exist yet) Thnx, Alejandro Sorry 4 my english On Fri, 11 Mar 2005 10:52:05 -0500 (EST), Bruce Momjian wrote: > Alejandro D

Re: [GENERAL] Temporary tables privileges

2005-03-11 Thread Bruce Momjian
Alejandro D. Burne wrote: > Hi, I'm new at pg. > I'll be using tmp tables in others rdbms. An user can create your own > tmp tables (grant temporary tables) but can't drop it (I don't want to > grant drop privileges). > Other way it's using on commit; but I can't make this work. > > Example: > CR

[GENERAL] Temporary tables privileges

2005-03-09 Thread Alejandro D. Burne
Hi, I'm new at pg. I'll be using tmp tables in others rdbms. An user can create your own tmp tables (grant temporary tables) but can't drop it (I don't want to grant drop privileges). Other way it's using on commit; but I can't make this work. Example: CREATE TEMPORARY TABLE tmp ON COMMIT DROP AS

Re: [GENERAL] Temporary tables and disk activity

2004-12-13 Thread Tom Lane
Phil Endecott <[EMAIL PROTECTED]> writes: > What would happen if I were to rollback at the end of the transaction, > rather than committing (having made no changes)? Would that eliminate > some or all of the catalog writes? It would avoid fsync'ing the changes at commit time, but not really red

Re: [GENERAL] Temporary tables and disk activity

2004-12-13 Thread Phil Endecott
Tom Lane wrote: Phil Endecott <[EMAIL PROTECTED]> writes: Does this make sense? I imagine that the temporary table is being added to these tables and then removed again. Yes, a temp table has the same catalog infrastructure as a regular table, so creation and deletion of a temp table will cause

Re: [GENERAL] Temporary tables and disk activity

2004-12-13 Thread Tom Lane
Phil Endecott <[EMAIL PROTECTED]> writes: > Does this make sense? I imagine that the temporary table is being added > to these tables and then removed again. Yes, a temp table has the same catalog infrastructure as a regular table, so creation and deletion of a temp table will cause some activit

Re: [GENERAL] Temporary tables and disk activity

2004-12-13 Thread Phil Endecott
Hi Tom, I thought of a quicker way to investiage this than strace and did an ls -lt in the data directory and looked up the tables that seem to change on every transaction in pg_class. They are the catalog tables: # ls -lt /var/lib/postgres/data/base/17142/ total 530108 -rw---1 postgres

Re: [GENERAL] Temporary tables and disk activity

2004-12-13 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Tom Lane wrote: > >> One of the things on the TODO list is making the size of temp-table > >> buffers user-configurable. (Temp table buffers are per-backend, they > >> are not part of the shared buffer arena.) With a large temp-table

Re: [GENERAL] Temporary tables and disk activity

2004-12-12 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> One of the things on the TODO list is making the size of temp-table >> buffers user-configurable. (Temp table buffers are per-backend, they >> are not part of the shared buffer arena.) With a large temp-table arena >> we'd never need

Re: [GENERAL] Temporary tables and disk activity

2004-12-12 Thread Bruce Momjian
Tom Lane wrote: > Martijn van Oosterhout <[EMAIL PROTECTED]> writes: > > I don't think temporary tables have any special rules regarding disk > > writes, so I'd expect them ot get written out like everything else. > > They'll be written out from PG's internal buffers, but IIRC they will > never be

Re: [GENERAL] Temporary tables and disk activity

2004-12-12 Thread Tom Lane
Phil Endecott <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> In principle, therefore, the kernel could hold temp table data in its >> own disk buffers and never write it out to disk until the file is >> deleted. In practice, of course, the kernel doesn't know the data is >> transient and will pr

Re: [GENERAL] Temporary tables and disk activity

2004-12-12 Thread Phil Endecott
Tom Lane wrote: They [temporary tables] > will be written out from PG's internal buffers, but IIRC they will never be fsync'd, and they definitely aren't WAL-logged. (These statements hold true in 8.0, but not sure how far back.) In principle, therefore, the kernel could hold temp table data in it

Re: [GENERAL] Temporary tables and disk activity

2004-12-12 Thread Tom Lane
Martijn van Oosterhout <[EMAIL PROTECTED]> writes: > I don't think temporary tables have any special rules regarding disk > writes, so I'd expect them ot get written out like everything else. They'll be written out from PG's internal buffers, but IIRC they will never be fsync'd, and they definitel

Re: [GENERAL] Temporary tables and disk activity

2004-12-12 Thread Martijn van Oosterhout
I don't think temporary tables have any special rules regarding disk writes, so I'd expect them ot get written out like everything else. The database doesn't know you're going to delete them later. Are the tables big? On Thu, Dec 09, 2004 at 10:10:21PM +, Phil Endecott wrote: > Dear All, > >

[GENERAL] Temporary tables and disk activity

2004-12-10 Thread Phil Endecott
Dear All, I sent a message last weekend asking about temporary tables being written to disk but didn't get any replies. I'm sure there is someone out there who knows something about this - please help! Here is the question again: Looking at vmstat output on my database server I have been supr

[GENERAL] Temporary tables and disk activity

2004-12-04 Thread Phil Endecott
Dear Postgresql experts, Looking at vmstat output on my database server I have been suprised to see lots of disk writes going on while it is doing what should be exclusively read-only transactions. I see almost no disk reads as the database concerned is small enough to fit into the OS disk cach

Re: [GENERAL] Temporary tables and miscellaneous schemas

2003-11-08 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > How about if we add a UNION that does: > > UNION > > SELECT 'non-local temp schemas skipped', NULL > > I think showing that would only be appropriate if we actually *did* skip > some. Finding that out would complicate the que

Re: [GENERAL] Temporary tables and miscellaneous schemas

2003-10-28 Thread Bruce Momjian
Sean Chittenden wrote: > > > > If you want to suppress *all* pg_temp_ schemas from the \dn listing, > > that would be defensible maybe. I'd be inclined to say that > > pg_toast should be hidden as well if that approach is taken, because > > then you are basically saying that \dn is not the truth

Re: [GENERAL] Temporary tables and miscellaneous schemas

2003-10-27 Thread Bruce Momjian
Sean Chittenden wrote: > > > If you see a pg_temp_* for every connection, that is a little > > > overwhelming. pg_toast and stuff aren't really too bad. Is there > > > any way to access your local temp schema in a way that doesn't > > > show the others? Could we use backend_pid in the query and

Re: [GENERAL] Temporary tables and miscellaneous schemas

2003-10-27 Thread Sean Chittenden
> > If you see a pg_temp_* for every connection, that is a little > > overwhelming. pg_toast and stuff aren't really too bad. Is there > > any way to access your local temp schema in a way that doesn't > > show the others? Could we use backend_pid in the query and show > > them only their own? >

Re: [GENERAL] Temporary tables and miscellaneous schemas

2003-10-25 Thread Bruce Momjian
Bruce Momjian wrote: > Sean Chittenden wrote: > > > I don't think that really answers my concern, since the sort of > > > folks who are likely to get confused by not being able to see > > > something that should be there are exactly the same ones who are not > > > likely to have turned on a non-def

Re: [GENERAL] Temporary tables and miscellaneous schemas

2003-10-13 Thread Bruce Momjian
Sean Chittenden wrote: > > I don't think that really answers my concern, since the sort of > > folks who are likely to get confused by not being able to see > > something that should be there are exactly the same ones who are not > > likely to have turned on a non-default "power user" setting. If

Re: [GENERAL] Temporary tables and miscellaneous schemas

2003-10-13 Thread Sean Chittenden
> >> I dislike putting random restrictions on what the \d displays > >> will show. We have done this in the past (eg, \df doesn't show > >> things it thinks are I/O functions) and by and large it's been a > >> mistake; I think it's created more confusion than it's prevented. > > > Hrm... psql's

Re: [GENERAL] Temporary tables and miscellaneous schemas

2003-10-13 Thread Tom Lane
Sean Chittenden <[EMAIL PROTECTED]> writes: >> I dislike putting random restrictions on what the \d displays will >> show. We have done this in the past (eg, \df doesn't show things it >> thinks are I/O functions) and by and large it's been a mistake; I >> think it's created more confusion than it

Re: [GENERAL] Temporary tables and miscellaneous schemas

2003-10-13 Thread Sean Chittenden
> > Why wouldn't you want to hide pg_temp_*? > > So you could see your own temp tables, for instance. > > I dislike putting random restrictions on what the \d displays will > show. We have done this in the past (eg, \df doesn't show things it > thinks are I/O functions) and by and large it's bee

Re: [GENERAL] Temporary tables and miscellaneous schemas

2003-10-12 Thread Tom Lane
<[EMAIL PROTECTED]> writes: > To follow-up then, if the temp schemas do not disappear, then over time > what happens (as temp tables are instantiated during normal application > usage), does the database end up with an ever-increasing number of these > temp schemas? No, you will never have more th

Re: [GENERAL] Temporary tables and miscellaneous schemas

2003-10-12 Thread Tom Lane
<[EMAIL PROTECTED]> writes: > What's up with these miscellaneous schemas? Are they in fact related to > the creation of temporary tables? Should they disappear when the session > closes, as should the temporary table? If they continue persisting after > the session closes, how do I get rid of them?

[GENERAL] Temporary tables and miscellaneous schemas

2003-10-12 Thread btober
Whenever I create a temporary table, with something like CREATE TEMPORARY TABLE temptable1 AS SELECT * FROM paid.ad_hoc_query; New schemas appear, with names like "pg_temp_1". I guess the appearance of these schemas with "temp" in the name indicates that they are "temporary" schemas and related t

[GENERAL] temporary tables

2001-02-13 Thread Alfonso Peniche
Since I cannot return a set of values (namely rows from a table) from a function, I thought I could create a temporary table where I could place the resulting information. Unfortunately I have a big problem. If I create this table and run the same procedure again (during the same session) I'll ge