-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPE-200 restructuring dex.trades with a macro approach #4533
Conversation
@Hosuke (or anyone else interested) this should be ready for review again. i'm comfortable with the current format, with a few minor caveats:
|
@jeff-dude as far as I understood you are materializing 3 steps:
Is this intended? As step 1 and step 2 are the same data which will be stored twice |
let's give it a shot with step 2 as a view, see how performance compares (will push in a sec) edit:
edit 2: |
This reverts commit 3778344.
The diff in counts may due to the latest refresh time. If we add an ending time filter, like
We may consider if we can add |
i think we can feel confident in row counts / raw amount totals: as for |
CI tests are looking good too 🔥 run times were improved by adding incremental predicates on the target & then also adding in a missing incremental filter in the |
AND p_sold.blockchain = base.blockchain | ||
{% if is_incremental() %} | ||
WHERE | ||
{{ incremental_predicate('base.block_time') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you moved this to the upper level it might improve incremental performance more. i mean:
with
...
stg_cte as (
select * from {{ stg_trades }}
{% if is_incremental() %}
where {{ incremental_predicate('base.block_time') }}
{% endif %}
)
...
from stg_cte
left join
...
filtering data as early as possible before joins almost always helps.
P.S: also — base
:/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can give it a shot, but not sure we'll gain much from what i've seen before.
ugh, why did they have to name their blockchain base
, that's such a useful word for aliases and such 🥲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i hope Stargate won't release their STG chain someday haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure we'll gain much from what i've seen before
dex_trades_beta [SUCCESS in 14.06s]
→ dex_trades_beta [SUCCESS in 9.90s]
not much, but still around 1.5x which can easily become x2-x3 on a larger dataset i think
(but it can be just bias)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow which tool are you using here, seems pretty helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Hosuke explain (format graphviz) select * from ...
→ any graphviz online tool
thank you again to all who provided feedback and helped push this beta version of the new while everything looked good on the logic within, there was some back and forth on naming standards across PR comments, dm's & internal convo. i've pushed some final commits with what we're sticking with for now:
i plan to merge this soon, then i can revisit the linked gh issue and summarize our findings within this PR. we can also use that issue to continue conversation as we test out the beta and obtain more feedback. |
Things to discuss:
Requirement of Macros/Models: Do we need macros implemented in macros/models/_sector/dex/platforms/uniswap_v2_forked_base_trades.sql?
Consistency with Proposed Ideas: I would like to confirm whether our current implementation aligns with the ideas presented in the [proposal] sector-level spells redesign #4637 and Sector spell design: how to organize the dbt lineage #4625