From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Jimmy Choi <yhjchoi(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Guideline on use of temporary tables |
Date: | 2007-10-15 09:32:27 |
Message-ID: | 471333AB.1010105@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Jimmy Choi wrote:
> I would like to use temporary table as a caching mechanism to speed up
> queries within the same session.
> Is this what temporary table is designed for? Are there caveats that I
> should be aware of? Can you think of other better alternatives?
It's a very common usage of temporary tables. Another is when loading
data that you want to process / split up.
Bear in mind that a temporary table is private to a particular backend,
so if you had 100 connections all using a temporary table for the same
query, that could be 100 copies of the data - not necessarily a
performance improvement.
Also, temporary tables have real entries in the system-tables, so make
sure autovacuum (or your manual vacuums) are scanning pg_class etc often
enough.
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Filip Rembiałkowski | 2007-10-15 09:45:10 | Re: pg_dump - schema diff compatibility |
Previous Message | Laurent ROCHE | 2007-10-15 09:02:02 | Re : pg_dump - schema diff compatibility |