Re: Problem with CREATE TABLE ... (LIKE ... INCLUDING INDEXES)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thom Brown <thom(at)linux(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem with CREATE TABLE ... (LIKE ... INCLUDING INDEXES)
Date: 2015-06-14 15:13:21
Message-ID: 9012.1434294801@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thom Brown <thom(at)linux(dot)com> writes:
> The commit refers to duplicate index names, and only for UNIQUE
> indexes. This behaviour is beyond that. And how does it determine
> which index to copy? In my example, I placed an index in a different
> tablespace. That could be on a drive with very different read/write
> characteristics than the default tablespace (seek latency/sequential
> read rate/write speed etc.) and possibly with different GUC
> parameters, but there's no way for us to determine if this is the
> case, so Postgres can easily remove the more performant one.

TBH, I have no particular concern for this argument. If you created
duplicate indexes you did a dumb thing anyway; you should not be expecting
that the system's response to that situation will be remarkably
intelligent. As the comment indicates, the code in question is really
only meant to deal with a specific kind of redundancy we'd observed in
real-world CREATE TABLE commands. It's probably accidental that it gets
applied in CREATE TABLE LIKE cases, but it doesn't bother me that it is.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-06-14 15:21:35 Re: 9.5 release notes
Previous Message Alvaro Herrera 2015-06-14 14:50:18 Re: Need Multixact Freezing Docs