summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-03-24 20:17:18 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-03-24 20:17:18 +0000
commitff301d6e690bb5581502ea3d8591a1600fd87acc (patch)
tree9fd8b2fa00cf35f8b2e66b0960e7e9ca90dfaa66 /src/backend/commands
parent9987f66001ef7f59dd8f8c92295732dba5507c4f (diff)
Implement "fastupdate" support for GIN indexes, in which we try to accumulate
multiple index entries in a holding area before adding them to the main index structure. This helps because bulk insert is (usually) significantly faster than retail insert for GIN. This patch also removes GIN support for amgettuple-style index scans. The API defined for amgettuple is difficult to support with fastupdate, and the previously committed partial-match feature didn't really work with it either. We might eventually figure a way to put back amgettuple support, but it won't happen for 8.4. catversion bumped because of change in GIN's pg_am entry, and because the format of GIN indexes changed on-disk (there's a metapage now, and possibly a pending list). Teodor Sigaev
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/analyze.c24
-rw-r--r--src/backend/commands/vacuum.c4
-rw-r--r--src/backend/commands/vacuumlazy.c4
3 files changed, 29 insertions, 3 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 33447b671f1..176ebde0efd 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.133 2009/01/22 20:16:01 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.134 2009/03/24 20:17:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -496,6 +496,28 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
/* We skip to here if there were no analyzable columns */
cleanup:
+ /* If this isn't part of VACUUM ANALYZE, let index AMs do cleanup */
+ if (!vacstmt->vacuum)
+ {
+ for (ind = 0; ind < nindexes; ind++)
+ {
+ IndexBulkDeleteResult *stats;
+ IndexVacuumInfo ivinfo;
+
+ ivinfo.index = Irel[ind];
+ ivinfo.vacuum_full = false;
+ ivinfo.analyze_only = true;
+ ivinfo.message_level = elevel;
+ ivinfo.num_heap_tuples = -1; /* not known for sure */
+ ivinfo.strategy = vac_strategy;
+
+ stats = index_vacuum_cleanup(&ivinfo, NULL);
+
+ if (stats)
+ pfree(stats);
+ }
+ }
+
/* Done with indexes */
vac_close_indexes(nindexes, Irel, NoLock);
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 4020bf1b294..78b179827ea 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.385 2009/01/16 13:27:23 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.386 2009/03/24 20:17:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3388,6 +3388,7 @@ scan_index(Relation indrel, double num_tuples)
ivinfo.index = indrel;
ivinfo.vacuum_full = true;
+ ivinfo.analyze_only = false;
ivinfo.message_level = elevel;
ivinfo.num_heap_tuples = num_tuples;
ivinfo.strategy = vac_strategy;
@@ -3454,6 +3455,7 @@ vacuum_index(VacPageList vacpagelist, Relation indrel,
ivinfo.index = indrel;
ivinfo.vacuum_full = true;
+ ivinfo.analyze_only = false;
ivinfo.message_level = elevel;
ivinfo.num_heap_tuples = num_tuples + keep_tuples;
ivinfo.strategy = vac_strategy;
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 4e4624cb132..cb73cfa87a7 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -29,7 +29,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.118 2009/01/22 19:25:00 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.119 2009/03/24 20:17:14 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -875,6 +875,7 @@ lazy_vacuum_index(Relation indrel,
ivinfo.index = indrel;
ivinfo.vacuum_full = false;
+ ivinfo.analyze_only = false;
ivinfo.message_level = elevel;
/* We don't yet know rel_tuples, so pass -1 */
ivinfo.num_heap_tuples = -1;
@@ -906,6 +907,7 @@ lazy_cleanup_index(Relation indrel,
ivinfo.index = indrel;
ivinfo.vacuum_full = false;
+ ivinfo.analyze_only = false;
ivinfo.message_level = elevel;
ivinfo.num_heap_tuples = vacrelstats->rel_tuples;
ivinfo.strategy = vac_strategy;