summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-02-13 01:43:50 +0000
committerrandomdan <randomdan@localhost>2011-02-13 01:43:50 +0000
commit735667b51cf74e6e12ca83374d5cf19f35c5bf40 (patch)
treefb98ec520bb46343d53e916078c2421d712cc158
parentUse a static local var for the loader map to work around the link/load order ... (diff)
downloadproject2-735667b51cf74e6e12ca83374d5cf19f35c5bf40.tar.bz2
project2-735667b51cf74e6e12ca83374d5cf19f35c5bf40.tar.xz
project2-735667b51cf74e6e12ca83374d5cf19f35c5bf40.zip
Minor tweaks to improve perforamce on PG bulk deletes
Fixes to support partial merges with bulk updates
-rw-r--r--project2/tablepatch.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/project2/tablepatch.cpp b/project2/tablepatch.cpp
index 3533b65..aacedbb 100644
--- a/project2/tablepatch.cpp
+++ b/project2/tablepatch.cpp
@@ -254,7 +254,7 @@ TablePatch::doUpdates(const char * where, const char * order)
// Build SQL for list of updates to perform ------------------------
// -----------------------------------------------------------------
Buffer updSql;
- updSql.appendf("UPDATE %s SET ",
+ updSql.appendf("UPDATE %s a SET ",
dest.c_str());
bool first = true;
foreach (Columns::const_iterator, cols, col) {
@@ -276,8 +276,8 @@ TablePatch::doUpdates(const char * where, const char * order)
else {
updSql.append(" AND ");
}
- updSql.appendf(" %s.%s = b.%s ",
- dest.c_str(), pki->c_str(), pki->c_str());
+ updSql.appendf(" a.%s = b.%s ",
+ pki->c_str(), pki->c_str());
}
updSql.append(" AND (");
first = true;
@@ -288,10 +288,10 @@ TablePatch::doUpdates(const char * where, const char * order)
}
first = false;
updSql.appendf(
- " (((CASE WHEN (%s.%s IS NULL AND b.%s IS NULL) THEN 1 ELSE 0 END) \
- + (CASE WHEN(%s.%s = b.%s) THEN 1 ELSE 0 END)) = 0)",
- dest.c_str(), col->c_str(), col->c_str(),
- dest.c_str(), col->c_str(), col->c_str());
+ " (((CASE WHEN (a.%s IS NULL AND b.%s IS NULL) THEN 1 ELSE 0 END) \
+ + (CASE WHEN(a.%s = b.%s) THEN 1 ELSE 0 END)) = 0)",
+ col->c_str(), col->c_str(),
+ col->c_str(), col->c_str());
}
}
updSql.append(")");