From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: RAM-only temporary tables |
Date: | 2008-11-06 01:42:30 |
Message-ID: | 20081106014230.GX4114@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Kevin Grittner wrote:
> An idea for a possible enhancement to PostgreSQL: allow creation of a
> temporary table without generating any disk I/O. (Creating and
> dropping a three-column temporary table within a database transaction
> currently generates about 150 disk writes).
Most of these are catalog updates. A trace of WAL logs including only
heap inserts says that to create a temp table with 3 columns (2 int, 1
text) and no indexes there are this many inserts:
3 1247 (pg_type)
20 1249 (pg_attribute)
3 1259 (pg_class)
7 2608 (pg_depend)
1 2610 (pg_index)
Note the excess of pg_attribute entries! There are 3 in the table, 3 in
the toast table, and then there are 14 extra attrs which are for system
columns (7 for the main table, 7 for the toast table). Just getting rid
of pg_attribute entries for those would probably prove to be an
importante gain. (Don't forget the index updates for each of those heap
inserts; for pg_type it's 2 btree inserts for each index insert.) If
you do this, you've shaved 42 of those 150 writes.
Perhaps another gain is getting rid of array types for temp tables; a
new feature of 8.3. Who wants those anyway? That also removes one or
two of the pg_depend entries. Maybe these extra array types are the
additional 8.3 overhead.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
From | Date | Subject | |
---|---|---|---|
Next Message | KaiGai Kohei | 2008-11-06 01:47:04 | Re: The suppress_redundant_updates_trigger() works incorrectly |
Previous Message | Gregory Stark | 2008-11-06 01:38:26 | Re: [WIP] In-place upgrade |