carp icon indicating copy to clipboard operation
carp copied to clipboard

Remove sea-orm usage for TransactionInput scanning

Open SebastienGllmt opened this issue 2 years ago • 0 comments

Right now use sea-orm Condition for TransactionInput fetching in the indexer.

This creates a large SQL query that looks like

 OR (
    "TransactionOutput"."output_index" = $2463
    AND "Transaction"."hash" = $2464
  )
  OR (
    "TransactionOutput"."output_index" = $2465
    AND "Transaction"."hash" = $2466
  )
  OR (
    "TransactionOutput"."output_index" = $2467
    AND "Transaction"."hash" = $2468
  )

which has bad performance. I think a custom SQL query that builds and queries for tuples (similar to sqlTransactionOutput.sql may perform faster. I'm not sure if sea-orm provides a functionality for this though

Note: I'm not sure if this will actually be faster. Just an optimistic hope since the sea-orm generated query can take 1.5s which is too slow to be acceptable

SebastienGllmt avatar May 10 '22 15:05 SebastienGllmt