add support for concurrent index builds
authorRobert Treat <robert@robert-treats-macbook.local>
Mon, 6 Jul 2009 01:07:38 +0000 (21:07 -0400)
committerRobert Treat <robert@robert-treats-macbook.local>
Mon, 6 Jul 2009 01:07:38 +0000 (21:07 -0400)
HISTORY
TODO
classes/database/Postgres.php
classes/database/Postgres81.php
indexes.php
lang/english.php
lang/recoded/english.php

diff --git a/HISTORY b/HISTORY
index ad9df0fba437f685f4e19a7cf28b144351bdba74..fb727aa261940e9a7d3de43caa15d19c7fcb1abd 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -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
diff --git a/TODO b/TODO
index 444fba58fd48bda5fd4ce225214824ce6614736c..b7990df766dd7ce9e4356c0f2508c3649889a169 100644 (file)
--- a/TODO
+++ b/TODO
@@ -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]
 
 
index 7f42dd892e8dd2ff39906fa8e677a197bdfe3029..9571b108bba48e71d5e70555920abc1c8aa74e06 100755 (executable)
@@ -3110,13 +3110,15 @@ class Postgres extends ADODB_base {
         * @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);
@@ -7575,6 +7577,7 @@ class Postgres extends ADODB_base {
        function hasForeignKeysInfo() { return $this->hasConstraintsInfo(); }
        function hasMagicTypes() { return true; }
        function hasQueryKill() { return true; }
+       function hasConcurrentIndexBuild() { return true; }
        
 }
 ?>
index 3701c68d3f7ce574e5f38c91ac1ddc03395b7d59..f8479a3f2b4de7b354a6cef7bf585d622c02c01e 100644 (file)
@@ -235,6 +235,7 @@ class Postgres81 extends Postgres82 {
 
        function hasCreateTableLikeWithConstraints() {return false;}
        function hasSharedComments() {return false;}
+       function hasConcurrentIndexBuild() {return false;}
 }
 
 ?>
index f95b24db9739f4eb827048eba5e737e65bf3d96a..08bc2f35e4d6879d3f140266a605f4a57dee9255 100644 (file)
                        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";
index db9a0d66a34f4b8d82537088195810b886c94ed7..a07585973330557eea74e07d68d8146e714365ee 100644 (file)
        $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';
index 7357470afb9ab0df5b48d150aed2d02a3c59c58c..f864eb17e475e244aa74e2f1d0b7239cc1599479 100644 (file)
        $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';