From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | Bo Guo <bo(dot)guo(at)gisticinc(dot)com>, Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>, pgsql-admin <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: When indexing is needed for a temp table |
Date: | 2025-04-25 22:41:08 |
Message-ID: | 00aaff3a04b0704940d48d29e38705d21512a12d.camel@cybertec.at |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Fri, 2025-04-25 at 09:43 -0700, Bo Guo wrote:
> When creating a temporary table for additional sql operations in a stored function,
> should I worry about building indexes on the temp table to increase performance when
> the temp table's row count exceeds a certain threshold? If so, is there a rule of
> thumb for the row count threshold?
Well, if a table is small, you don't need an index. It is hard to say what is small.
For one, it depends on the size of the rows.
In general, I would say that it never pays to build an index on a temporary table
unless you are using that index at least twice.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Sbob | 2025-04-26 17:09:32 | Intermittent missing chunk ERRORS |
Previous Message | Bo Guo | 2025-04-25 16:43:38 | When indexing is needed for a temp table |