Re: Automatic Index Creation for Column Types - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Automatic Index Creation for Column Types
Date
Msg-id 521220B0.5010307@dunslane.net
Whole thread Raw
In response to Automatic Index Creation for Column Types  (Charles Sheridan <cesheri@swbell.net>)
Responses Re: Automatic Index Creation for Column Types  (Charles Sheridan <cesheri@swbell.net>)
List pgsql-hackers
On 08/19/2013 09:10 AM, Charles Sheridan wrote:
> Hi,
>
> I don't see indication that the capability described below exists in
> Postgres (or any RDBMS), so this is likely a feature request --
>
> For column types that are frequently defined in tables, and which are
> typically indexed, it would be helpful to be able to specify in the type
> definition of the column that its addition/creation into a table should
> be automatically accompanied by the creation of an associated index.
>
> Auto-index generation for a specific column type would be overridable
> for specific tables, as you wouldn't always want to auto-create an index
> at the time of column addition to a table. In the case of CREATE TABLE,
> this would be less of a concern, and more of a concern for ALTER TABLE
> ADD COLUMN.
>
> Such a configuration would also specify the type of index.
>
> What do you think ?
>
>
>


I think it's a bad idea. Indexes are not free and it would be a huge and 
unwarranted assumption that they are wanted just because some column 
type is used. If you want indexes it's up to you to create them. The 
only exception is when they are created as an implementation artifact 
for a table constraint, but even then you have to express the 
constraint, it's not just assumed.

cheers

andrew





pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Automatic Index Creation for Column Types
Next
From: Michael Cronenworth
Date:
Subject: Re: Fix Windows socket error checking for MinGW