diff options
author | Marco Boss <bossm8@bfh.ch> | 2022-04-07 10:22:03 +0200 |
---|---|---|
committer | Marco Boss <bossm8@bfh.ch> | 2022-04-07 10:22:03 +0200 |
commit | 716165ff0be4a3d13008dd42f2f95c1549cdf988 (patch) | |
tree | caa7cc4e18209c4221dc7e302fed8a426f1eefdc | |
parent | fe2a15c558bec2302678035c62a9a42d0d509773 (diff) | |
download | exchange-dev/boss/sharding.tar.gz exchange-dev/boss/sharding.tar.bz2 exchange-dev/boss/sharding.zip |
recoup_by_reserve without materializeddev/boss/sharding
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 47ac6ad2..e1ad59a1 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -1985,26 +1985,21 @@ prepare_statements (struct PostgresClosure *pg) " ON (recoup_by_reserve.reserve_out_serial_id = reserves_out.reserve_out_serial_id)" " WHERE reserves.reserve_pub=$1);", */ - "WITH res AS MATERIALIZED ( " - " SELECT * " - " FROM reserves " - " WHERE reserve_pub = $1 " - "), " - "coin_pub AS MATERIALIZED ( " - " SELECT coin_pub " - " FROM recoup_by_reserve " - " JOIN (reserves_out " - " JOIN ( " - " SELECT * " - " FROM reserves_out_by_reserve " - " WHERE reserves_out_by_reserve.reserve_uuid = ( " - " SELECT reserve_uuid FROM res " - " ) " - " ) reserves_out_by_reserve " - " ON (reserves_out_by_reserve.h_blind_ev = reserves_out.h_blind_ev)) " - " ON (recoup_by_reserve.reserve_out_serial_id = reserves_out.reserve_out_serial_id) " - ") " - "SELECT recoup.coin_pub " + "WITH res AS MATERIALIZED " + " ( " + " SELECT * " + " FROM reserves " + " WHERE reserve_pub = $1 " + " ), " + "ro AS MATERIALIZED " + " ( " + " SELECT reserve_out_serial_id " + " FROM reserves_out " + " WHERE reserves_out.reserve_uuid = " + " (SELECT reserve_uuid FROM res) " + " ) " + "SELECT " + " recoup.coin_pub " " ,recoup.coin_sig " " ,recoup.coin_blind " " ,recoup.amount_val " @@ -2015,11 +2010,10 @@ prepare_statements (struct PostgresClosure *pg) "FROM denominations " " JOIN (known_coins " " JOIN recoup " - " ON (recoup.coin_pub = known_coins.coin_pub)) " - " ON (known_coins.denominations_serial = denominations.denominations_serial) " - "WHERE recoup.coin_pub = ( " - " SELECT coin_pub FROM coin_pub " - "); ", + " ON (recoup.coin_pub = known_coins.coin_pub) " + " ) ON (known_coins.denominations_serial = denominations.denominations_serial) " + "WHERE recoup.reserve_out_serial_id = " + " (SELECT reserve_out_serial_id FROM ro); ", 1), /* Used in #postgres_get_coin_transactions() to obtain recoup transactions affecting old coins of refreshed coins */ |