we don't need to join on state_cids in the pessimistic case anymore

This commit is contained in:
i-norden 2023-03-07 18:44:12 -06:00
parent afc47af045
commit 42803af51a
2 changed files with 0 additions and 12 deletions

View File

@ -61,18 +61,12 @@ BEGIN
v_block_no v_block_no
) AS state_leaf_removed ) AS state_leaf_removed
FROM eth.storage_cids FROM eth.storage_cids
INNER JOIN eth.state_cids ON (
storage_cids.header_id = state_cids.header_id
AND storage_cids.block_number = state_cids.block_number
AND storage_cids.state_leaf_key = state_cids.state_leaf_key
)
INNER JOIN eth.header_cids ON ( INNER JOIN eth.header_cids ON (
state_cids.header_id = header_cids.block_hash state_cids.header_id = header_cids.block_hash
AND state_cids.block_number = header_cids.block_number AND state_cids.block_number = header_cids.block_number
) )
WHERE state_leaf_key = v_state_leaf_key WHERE state_leaf_key = v_state_leaf_key
AND storage_leaf_key = v_storage_leaf_key AND storage_leaf_key = v_storage_leaf_key
AND state_cids.block_number <= v_block_no
AND storage_cids.block_number <= v_block_no AND storage_cids.block_number <= v_block_no
AND header_cids.block_number <= v_block_no AND header_cids.block_number <= v_block_no
AND header_cids.block_hash = (SELECT canonical_header_hash(header_cids.block_number)) AND header_cids.block_hash = (SELECT canonical_header_hash(header_cids.block_number))

View File

@ -260,18 +260,12 @@ BEGIN
v_block_no v_block_no
) AS state_leaf_removed ) AS state_leaf_removed
FROM eth.storage_cids FROM eth.storage_cids
INNER JOIN eth.state_cids ON (
storage_cids.header_id = state_cids.header_id
AND storage_cids.block_number = state_cids.block_number
AND storage_cids.state_leaf_key = state_cids.state_leaf_key
)
INNER JOIN eth.header_cids ON ( INNER JOIN eth.header_cids ON (
state_cids.header_id = header_cids.block_hash state_cids.header_id = header_cids.block_hash
AND state_cids.block_number = header_cids.block_number AND state_cids.block_number = header_cids.block_number
) )
WHERE state_leaf_key = v_state_leaf_key WHERE state_leaf_key = v_state_leaf_key
AND storage_leaf_key = v_storage_leaf_key AND storage_leaf_key = v_storage_leaf_key
AND state_cids.block_number <= v_block_no
AND storage_cids.block_number <= v_block_no AND storage_cids.block_number <= v_block_no
AND header_cids.block_number <= v_block_no AND header_cids.block_number <= v_block_no
AND header_cids.block_hash = (SELECT canonical_header_hash(header_cids.block_number)) AND header_cids.block_hash = (SELECT canonical_header_hash(header_cids.block_number))