Re: temporary indexes?

From: melvin6925 <melvin6925(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Jonathan Vanasco <postgres(at)2xlp(dot)com>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: temporary indexes?
Date: 2015-10-21 19:39:14
Message-ID: sry7ivvjde432bxlei1jhh4w.1445456354109@email.android.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

What Adrian is saying is that there is no need for "temporary" indexes. You can create the idxs on a temp table and they get dropped when you drop the table.

Sent via the Samsung Galaxy S® 6, an AT&T 4G LTE smartphone-------- Original message --------From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> Date: 10/21/2015 14:50 (GMT-05:00) To: Jonathan Vanasco <postgres(at)2xlp(dot)com>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org> Subject: Re: [GENERAL] temporary indexes?
On 10/21/2015 11:43 AM, Jonathan Vanasco wrote:
> I couldn't find any mention of this on the archives...
>
> Have the project maintainers ever considered extending CREATE INDEX to support "temporary" indexes like CREATE TEMPORARY TABLE?
>
> When creating temporary tables for analytics/reporting, I've noticed that I often need to create (then drop) indexes on regular tables.  Temporary indexes seemed like a natural fit here, so i was wondering if there was any reason why they're not supported (other than no one wanted it!)

Something like this?:

aklaver(at)test=> create temporary table temp_test(id int, fld_1 varchar);
CREATE TABLE

aklaver(at)test=> create index temp_idx on temp_test(fld_1);
CREATE INDEX

aklaver(at)test=> \d temp_test
       Table "pg_temp_2.temp_test"
  Column |       Type        | Modifiers
--------+-------------------+-----------
  id     | integer           |
  fld_1  | character varying |
Indexes:
     "temp_idx" btree (fld_1)

>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-10-21 19:42:58 Re: temporary indexes?
Previous Message bricklen 2015-10-21 19:31:13 Re: ERROR: invalid page in block 1226710 of relation base/16750/27244