Skip to content

Commit

Permalink
add support for concurrent index builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Treat committed Jul 6, 2009
1 parent 6de576e commit a14fcf2
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions HISTORY
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Features
* Support for Column Level Privileges
* Allow users to specify a template database at database creation time
* Support killing processes
* Add ability to create indexes concurrently

Bugs
* Fix problems with query tracking on overly long queries
Expand Down
1 change: 0 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ Indexes

* Support 8.1 Reindex [Database|System] commands
* Expressional indexes
* Allow indexes to be built concurrently [8.2]
* Create Index Asc/Desc, Nulls First/Last [8.3]


Expand Down
7 changes: 5 additions & 2 deletions classes/database/Postgres.php
Original file line number Diff line number Diff line change
Expand Up @@ -3110,13 +3110,15 @@ function getIndexes($table = '', $unique = false) {
* @param $tablespace The tablespaces ('' means none/default)
* @return 0 success
*/
function createIndex($name, $table, $columns, $type, $unique, $where, $tablespace) {
function createIndex($name, $table, $columns, $type, $unique, $where, $tablespace, $concurrently) {
$this->fieldClean($name);
$this->fieldClean($table);

$sql = "CREATE";
if ($unique) $sql .= " UNIQUE";
$sql .= " INDEX \"{$name}\" ON \"{$this->_schema}\".\"{$table}\" USING {$type} ";
$sql .= " INDEX";
if ($concurrently) $sql .= " CONCURRENTLY";
$sql .= " \"{$name}\" ON \"{$this->_schema}\".\"{$table}\" USING {$type} ";

if (is_array($columns)) {
$this->arrayClean($columns);
Expand Down Expand Up @@ -7575,6 +7577,7 @@ function hasAlterDatabase() { return $this->hasAlterDatabaseRename(); }
function hasForeignKeysInfo() { return $this->hasConstraintsInfo(); }
function hasMagicTypes() { return true; }
function hasQueryKill() { return true; }
function hasConcurrentIndexBuild() { return true; }

}
?>
1 change: 1 addition & 0 deletions classes/database/Postgres81.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ function getTablespaces($all = false) {

function hasCreateTableLikeWithConstraints() {return false;}
function hasSharedComments() {return false;}
function hasConcurrentIndexBuild() {return false;}
}

?>
7 changes: 7 additions & 0 deletions indexes.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ function doCreateIndex($msg = '') {
echo "\t\t\t</select>\n\t\t</td>\n\t</tr>\n";
}

if ($data->hasConcurrentIndexBuild()) {
echo "<tr>";
echo "<th class=\"data left\" scope=\"row\"><label for=\"formConcur\">{$lang['strconcurrently']}</label></th>";
echo "<td class=\"data1\"><input type=\"checkbox\" id=\"formConcur\" name=\"formConcur\"", (isset($_POST['formConcur']) ? 'checked="checked"' : ''), " /></td>";
echo "</tr>";
}

echo "</table>";

echo "<p><input type=\"hidden\" name=\"action\" value=\"save_create_index\" />\n";
Expand Down
1 change: 1 addition & 0 deletions lang/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@
$lang['strconfcluster'] = 'Are you sure you want to cluster "%s"?';
$lang['strclusteredgood'] = 'Cluster complete.';
$lang['strclusteredbad'] = 'Cluster failed.';
$lang['strconcurrently'] = 'Concurrently';

// Rules
$lang['strrules'] = 'Rules';
Expand Down
1 change: 1 addition & 0 deletions lang/recoded/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@
$lang['strconfcluster'] = 'Are you sure you want to cluster &quot;%s&quot;?';
$lang['strclusteredgood'] = 'Cluster complete.';
$lang['strclusteredbad'] = 'Cluster failed.';
$lang['strconcurrently'] = 'Concurrently';

// Rules
$lang['strrules'] = 'Rules';
Expand Down

0 comments on commit a14fcf2

Please sign in to comment.