diff options
author | randomdan <randomdan@localhost> | 2011-02-13 01:43:50 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2011-02-13 01:43:50 +0000 |
commit | cf8191a8503b314c8065e48b613ce4f20e6fe40d (patch) | |
tree | fb98ec520bb46343d53e916078c2421d712cc158 | |
parent | Use a static local var for the loader map to work around the link/load order ... (diff) | |
download | project2-cf8191a8503b314c8065e48b613ce4f20e6fe40d.tar.bz2 project2-cf8191a8503b314c8065e48b613ce4f20e6fe40d.tar.xz project2-cf8191a8503b314c8065e48b613ce4f20e6fe40d.zip |
Minor tweaks to improve perforamce on PG bulk deletes
Fixes to support partial merges with bulk updates
-rw-r--r-- | project2/tablepatch.cpp | 14 |
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(")"); |