Open xin-hedera opened 2 years ago
was able to rewrite the contract logs SQL query to be citus compatible after some research in PR #4749. However, will leave this ticket open just in case it may still be needed for potential performance improvement. Will close once we verify performance with existing query looks good.
Problem
Due to citus limit on lateral subquery with limit clause support, all contract logs related REST API fail on the underlying SQL statement which joins on a lateral subquery with limit to find the corresponding block number and block hash.
We can instead add a block number column to contract log and then change the query to inner join
record_file
on block number.Solution
block_number bigint not null
to tablecontract_log
and backfill datarecordFileIndex
toRecordItem
and populate it in record file readersblockNumber
toContractLog
and set it with the value from theRecordItem
record_file
Alternatives
No response