Tatsuo Ishii <ishii@postgresql.org> writes:
>> Remember that what will happens is probably:
>>
>> ERROR: aborting due to exceeding temp file limit. Current usage 8000kB,
>> requested size 8008kB, thus it will exceed temp file limit 8kB.
> Could you please elaborate why "Current usage 8000kB" can bigger than
> "temp file limit 8kB"? I undertstand the point that temp files are
> allocated by 8kB at once, but I don't understand why those numbers you
> suggested could happen. Actually I tried with the modified patches and
> got:
> test=# CREATE TEMPORARY TABLE resourcetemp1 AS SELECT generate_series(1,100000);
> SELECT 100000
> test=# SET temp_file_limit = 578;
> SET
> test=# SELECT count(*) FROM (select * FROM resourcetemp1 ORDER BY 1) AS a;
> ERROR: aborting due to exceeding temp file limit, current usage 576kB, requested size 8192kB, thus it will exceed
tempfile limit 578kB
You didn't show us how you computed those numbers, but I'm really
dubious that FileWrite() has got any ability to produce numbers that
are helpful. Like Cedric, I think the write amount in any one call
is usually going to be one block.
regards, tom lane