duneanalytics / spellbook

SQL views for Dune
Other
1.11k stars 1.02k forks source link

[Request] Add "transactions" fields to all cross-chain raw & spell tables (Or materialize `evms`) #5257

Open MSilb7 opened 5 months ago

MSilb7 commented 5 months ago

Description

Currently, when querying cross-chain raw tables (i.e. evms.traces) or spells (i.e. nft.transfers), we have to do intensive joins to pull top-level transaction data (evms.transactions) which cause query timeouts.

Proposal

Add all transactions fields to the lower-level traces, logs, nft transfers, dex trades, nft trades, etc tables (i.e. gas_used, gas_price, l1_fee, l1_gas_used, data, gas_limit)

Alt

Another alternative (imo much better) solution would be to make the emvs schema "native" rather than being a view of lower-level blockchain tables. "Single-chain" queries are becoming more and more rare in my experience, and emvs performance is a drag. See - https://github.com/duneanalytics/spellbook/issues/4693

This saves computation query resources & eliminates the manual overhead to track which chains need which fields. It should also make cross-chain spell design infinitely easier, since we won't need to duplicate models for each chain.

MSilb7 commented 5 months ago

Example queries where these joins (and lack of native evms) creates query timeout

hawkaa commented 5 months ago

Thanks @MSilb7 ! Love the input, and especially providing two alternatives.

This is on our radar and has been for a while. I would however not hold my breath, as this is not something we have planned to do just yet!