Skip to content

Commit

Permalink
Modify outer left join query to use existing index. (#822)
Browse files Browse the repository at this point in the history
  • Loading branch information
winder authored Jan 14, 2022
1 parent bf6d626 commit 1313f26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions idb/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ func buildTransactionQuery(tf idb.TransactionFilter) (query string, whereArgs []
query += " JOIN txn_participation p ON t.round = p.round AND t.intra = p.intra"
}

// join in the root transaction
query += " LEFT OUTER JOIN txn root ON t.round = root.round AND t.extra->>'root-intra' = root.intra::text"
// join in the root transaction if there is one
query += " LEFT OUTER JOIN txn root ON t.round = root.round AND (t.extra->>'root-intra')::int = root.intra"

if len(whereParts) > 0 {
whereStr := strings.Join(whereParts, " AND ")
Expand Down

0 comments on commit 1313f26

Please sign in to comment.