Currently, in order to get the data I need, I need to execute several SQL statements:
SELECT pubkey.pubkey_id FROM pubkey WHERE pubkey.pubkey_hash = (input data [1]) SELECT txin_corr.tx_id FROM txin_corr WHERE txin_corr.pubkey_id = (pubkey.pubkey_id from previous query [max. 1]) SELECT txin_corr.pubkey_id FROM txin_corr WHERE txin_corr.tx_id = (txin_corr.tx_id from prev.qry. [n]) SELECT pubkey.pubkey_hash FROM pubkey WHERE pubkey.pubkey_id = (txin_corr.pubkey_id from prev.qry. [n])
The first request is not a problem, because I need to do this only once. But I am wondering if there is a way to combine (at least) the last three queries. Since the db is quite large (~ 20 GB), I think that a βgood requestβ can significantly speed up the process.
What I'm doing: for a given pubkey_id / pubkey_hash , get all tx_id from txin_corr that contain this pubkey_id on the same line. Then get all pubkey_id from txin_corr , where the string contains the extracted tx_id s. Finally, get all pubkey_hash for the now found pubkey_id s.
Micha source share