From 817e64342047089d861493cb4c4ae3b97d95482d Mon Sep 17 00:00:00 2001 From: Brannon King Date: Tue, 16 Jun 2020 23:07:11 -0600 Subject: [PATCH] use a better index on support table --- configure.ac | 4 ++-- src/claimtrie/trie.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index b154fa168..a012507c7 100644 --- a/configure.ac +++ b/configure.ac @@ -3,9 +3,9 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 17) define(_CLIENT_VERSION_REVISION, 4) -define(_CLIENT_VERSION_BUILD, 5) +define(_CLIENT_VERSION_BUILD, 6) define(_CLIENT_VERSION_IS_RELEASE, true) -define(_COPYRIGHT_YEAR, 2019) +define(_COPYRIGHT_YEAR, 2020) define(_COPYRIGHT_HOLDERS,[The %s developers]) define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[LBRYcrd Core]]) AC_INIT([LBRYcrd Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/lbryio/lbrycrd/issues],[lbrycrd],[https://lbry.com/]) diff --git a/src/claimtrie/trie.cpp b/src/claimtrie/trie.cpp index 4fd229a78..2a2e4a5f0 100644 --- a/src/claimtrie/trie.cpp +++ b/src/claimtrie/trie.cpp @@ -126,7 +126,7 @@ void CClaimTrie::doNodeTableMigration() for (auto&& row : db << "SELECT claimsHash FROM node WHERE name = x''") break; } catch (const sqlite::sqlite_exception&) { - + logPrint << "Running one-time upgrade of node table to cache the hash of claims..." << Clog::endl; isNodeMigrationStart = true; // new node schema @@ -391,7 +391,7 @@ int64_t CClaimTrieCacheBase::getTotalValueOfClaimsInTrie(bool fControllingOnly) int64_t ret = 0; const std::string query = fControllingOnly ? "SELECT SUM(amount) FROM (SELECT c.amount as amount, " - "(SELECT(SELECT IFNULL(SUM(s.amount),0)+c.amount FROM support s " + "(SELECT(SELECT IFNULL(SUM(s.amount),0)+c.amount FROM support s INDEXED BY support_supportedClaimID " "WHERE s.supportedClaimID = c.claimID AND c.nodeName = s.nodeName " "AND s.activationHeight < ?1 AND s.expirationHeight >= ?1) as effective " "ORDER BY effective DESC LIMIT 1) as winner FROM claim c " @@ -581,7 +581,7 @@ const std::string childHashQuery_s = "SELECT name, hash FROM node WHERE parent = const std::string claimHashQuery_s = "SELECT c.txID, c.txN, c.claimID, c.updateHeight, c.activationHeight, c.amount, " - "(SELECT IFNULL(SUM(s.amount),0)+c.amount FROM support s " + "(SELECT IFNULL(SUM(s.amount),0)+c.amount FROM support s INDEXED BY support_supportedClaimID " "WHERE s.supportedClaimID = c.claimID AND s.nodeName = c.nodeName " "AND s.activationHeight < ?1 AND s.expirationHeight >= ?1) as effectiveAmount " "FROM claim c WHERE c.nodeName = ?2 AND c.activationHeight < ?1 AND c.expirationHeight >= ?1 " -- 2.45.3