Better name/syntax for "online" index creation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Cc: Greg Stark <gsstark(at)mit(dot)edu>
Subject: Better name/syntax for "online" index creation
Date: 2006-07-24 15:13:55
Message-ID: 10977.1153754035@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm fairly dissatisfied with the naming of Greg Stark's proposed new
feature for creating indexes without blocking writers of the table.
To my mind, "ONLINE" just doesn't convey any useful information ---
the existing CREATE INDEX functionality could already be said to be
"online", in the sense that you don't have to take down the database
to do it. I thought about "SHARED" but someone could probably raise
the same objection to it. Anyone have a better idea?

I'm also wondering about where in the command the keyword should go.
As submitted it's

( { <replaceable class="parameter">column</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ <replaceable class="parameter">opclass</replaceable> ] [, ...] )
[ WITH ( <replaceable class="PARAMETER">storage_parameter</replaceable> = <replaceable class="PARAMETER">value</replaceable> [, ... ] ) ]
[ TABLESPACE <replaceable class="parameter">tablespace</replaceable> ]
+ [ ONLINE]
[ WHERE <replaceable class="parameter">predicate</replaceable> ]

which seems a bit randomly chosen; what's more it creates a problem for
psql, which would have to parse nearly the entire command to discover
whether it's safe to execute inside a transaction block or not.
I'm tempted to put the new keyword at the very front:

SHARED CREATE INDEX ....

which would probably mean that we'd have to document it as if it were a
completely separate command from CREATE INDEX, but then again that might
not be a bad thing considering how differently the two cases behave.
If not that, we probably still need to put it somewhere near the front
for psql's sake.

Comments?

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2006-07-24 15:20:12 Re: Better name/syntax for "online" index creation
Previous Message Florian G. Pflug 2006-07-24 15:12:18 Re: UPDATE/DELETE XXX WHERE CURRENT OF cursor_name