diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2022-03-19 08:27:01 +0100 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2022-03-19 08:27:01 +0100 |
commit | 280f94c3a664520f1f63ea353556c5bc84fee87f (patch) | |
tree | 57a01d37a12cd5ac84ef9439fab0b00a09d4561b /src/exchangedb | |
parent | f0a95037ef13246b48f65b79e04292bc198c1279 (diff) |
improve style of some SQL queries (no semantic change)
Diffstat (limited to 'src/exchangedb')
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 6912e55e0..c078d65a7 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -722,13 +722,13 @@ prepare_statements (struct PostgresClosure *pg) ",ro.amount_with_fee_frac" ",denom.fee_withdraw_val" ",denom.fee_withdraw_frac" - " FROM denominations denom" - " JOIN reserves_out ro" - " ON (ro.denominations_serial = denom.denominations_serial)" + " FROM reserves res" " JOIN reserves_out_by_reserve ror" - " ON (ro.h_blind_ev = ror.h_blind_ev)" - " JOIN reserves res" " ON (res.reserve_uuid = ror.reserve_uuid)" + " JOIN reserves_out ro" + " ON (ro.h_blind_ev = ror.h_blind_ev)" + " JOIN denominations denom" + " ON (ro.denominations_serial = denom.denominations_serial)" " WHERE res.reserve_pub=$1;", 1), /* Used in #postgres_select_withdrawals_above_serial_id() */ @@ -1654,17 +1654,17 @@ prepare_statements (struct PostgresClosure *pg) " recoup_timestamp," " denoms.denom_pub_hash," " coins.denom_sig" - " FROM denominations denoms" - " JOIN known_coins coins" - " ON (coins.denominations_serial = denoms.denominations_serial)" - " JOIN recoup rc" - " ON (rc.coin_pub = coins.coin_pub)" - " JOIN reserves_out ro" - " ON (ro.reserve_out_serial_id = rc.reserve_out_serial_id)" + " FROM reserves res" " JOIN reserves_out_by_reserve ror" - " ON (ror.h_blind_ev = ro.h_blind_ev)" - " JOIN reserves res" " ON (res.reserve_uuid = ror.reserve_uuid)" + " JOIN reserves_out ro" + " ON (ror.h_blind_ev = ro.h_blind_ev)" + " JOIN recoup rc" + " ON (ro.reserve_out_serial_id = rc.reserve_out_serial_id)" + " JOIN known_coins coins" + " ON (rc.coin_pub = coins.coin_pub)" + " JOIN denominations denoms" + " ON (coins.denominations_serial = denoms.denominations_serial)" " WHERE res.reserve_pub=$1;", 1), /* Used in #postgres_get_coin_transactions() to obtain recoup transactions @@ -1743,6 +1743,9 @@ prepare_statements (struct PostgresClosure *pg) ",recoup_timestamp" ",recoup_uuid" " FROM recoup" + // FIXME: suboptimal sub-query here: crosses shards! + // MAYBE: replace reserve_out_serial_id with + // reserve_pub and use new reserve_out_by_reserve table? " JOIN reserves_out ro" " USING (reserve_out_serial_id)" " JOIN reserves" |