Re: fun fact about temp tables - Mailing list pgsql-general

From Tom Lane
Subject Re: fun fact about temp tables
Date
Msg-id 16963.1470412247@sss.pgh.pa.us
Whole thread Raw
In response to Re: fun fact about temp tables  (Grigory Smolkin <g.smolkin@postgrespro.ru>)
List pgsql-general
Grigory Smolkin <g.smolkin@postgrespro.ru> writes:
> Thank you for your answer.
> But it`s temporary table so it`s equal to saying 'I don`t care about
> this data' and I can get 'out of disk space' regardless of using
> temporary tables.

> What are we winning here?

Sane behavior.  Would you really want this:

    => CREATE TEMP TABLE foo(...);
    CREATE TABLE
    => INSERT INTO foo SELECT lots-o-rows;
    INSERT nnnn
    ... much later ...
    => SELECT * FROM unrelated_temp_table;
    ERROR: out of disk space

If we might suffer out-of-disk-space while flushing a buffer, that's
what we'd risk.  So we allocate the disk space before accepting the
INSERT in the first place.

            regards, tom lane


pgsql-general by date:

Previous
From: Alex Ignatov
Date:
Subject: Re: fun fact about temp tables
Next
From: Tom Lane
Date:
Subject: Re: fun fact about temp tables