Commit c63ec2f
feat(solana): add executing_account_prefix predicates for instruction_calls partition pruning (#9674)
* feat(solana): add executing_account_prefix predicates for instruction_calls partition pruning
solana.instruction_calls is partitioned by (year, month, executing_account_prefix) where executing_account_prefix = substring(executing_account, 1, 2). With Base58, that's 12 * 58^2 = ~40k partitions/year.
Trino 479 cannot derive prefix predicates from full-address predicates (trinodb/trino#19455), so the partition column is not used unless we filter on it explicitly. Spellbook models all filter on the full executing_account, never on the prefix, so partition enumeration dominates planning time and pushes complex models over the 600s query.max-planning-time ceiling.
Adding 'AND executing_account_prefix = ''XX''' alongside the existing executing_account literal predicate gives Trino a constant partition predicate at plan time, cutting splits-generation by ~60%. Mirrors the account_activity fix in #9670.
Towards DWH-642
* feat(solana): extend executing_account_prefix predicate to amm staging macro and opensea
Adds the prefix predicate to:
- solana_amm_stg_raw_swaps macro -- one line that propagates to 14 DEX
staging callers (alphaq, aquifer, aquifer_v2, bisonfi, byreal, goonfi,
goonfi_v2, manifest, obric, scorch, solfi_v2, tessera, whalestreet,
zerofi). The macro takes program_id as an argument so '{{ program_id[:2] }}'
derives the prefix at compile time from each caller's literal.
- opensea_solana_token_trades (daily_spellbook) -- MemoSq4gqA... program
with prefix 'Me'.
Same Jinja slice pattern as the per-model fixes in e2c5371 and the
account_activity fix in #9670. With the prior commit this covers all
literal-predicate readers of solana.instruction_calls in the spellbook
project.
Towards DWH-642
---------
Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com>1 parent ccc96b6 commit c63ec2f
13 files changed
Lines changed: 18 additions & 0 deletions
File tree
- dbt_subprojects
- daily_spellbook/models/_projects/opensea/solana
- solana
- macros/_sector/dex
- models
- _sector
- dex
- humidifi
- orca_whirlpool
- phantom_swapper
- pumpdotfun/solana
- pumpswap
- sanctum_router
- gas
- jupiter
- solana_utils
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| 276 | + | |
276 | 277 | | |
277 | 278 | | |
278 | 279 | | |
| |||
dbt_subprojects/solana/models/_sector/dex/phantom_swapper/phantom_swapper_solana_fee_addresses.sql
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
0 commit comments