Re: When indexing is needed for a temp table - Mailing list pgsql-admin

From Laurenz Albe
Subject Re: When indexing is needed for a temp table
Date
Msg-id 00aaff3a04b0704940d48d29e38705d21512a12d.camel@cybertec.at
Whole thread Raw
In response to When indexing is needed for a temp table  (Bo Guo <bo.guo@gisticinc.com>)
List 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



pgsql-admin by date:

Previous
From: Bo Guo
Date:
Subject: When indexing is needed for a temp table
Next
From: Sbob
Date:
Subject: Intermittent missing chunk ERRORS