Skip to content

Maayan via Elementary: Optimize agg_sessions: explicit columns & incremental filter#906

Open
joostboon wants to merge 1 commit intomasterfrom
elementary-optimize-agg-sessions-k7m3x2-184232
Open

Maayan via Elementary: Optimize agg_sessions: explicit columns & incremental filter#906
joostboon wants to merge 1 commit intomasterfrom
elementary-optimize-agg-sessions-k7m3x2-184232

Conversation

@joostboon
Copy link
Copy Markdown
Collaborator

Summary\n\nThis PR optimizes the agg_sessions incremental model with two key changes:\n\n### Changes\n\n1. Replaced SELECT * with explicit column selection — Only the 6 required columns (session_id, customer_id, ad_id, started_at, ended_at, utm_source) are now selected, reducing I/O and protecting against upstream schema changes.\n\n2. Added {% if is_incremental() %} filter — On incremental runs, only new sessions (based on started_at) are processed instead of full-scanning both source tables. This should significantly reduce execution time from the current ~186s.\n\n### Impact\n- Reduced warehouse I/O costs\n- Faster incremental runs\n- More resilient to upstream schema changes

Created by: maayan+172@elementary-data.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant