Skip to content

Perf: use table name reference directly instead of select * subquery …#3991

Merged
tobymao merged 2 commits intoSQLMesh:mainfrom
z3z1ma:perf/only-use-subq-in-audit-if-needed
Mar 14, 2025
Merged

Perf: use table name reference directly instead of select * subquery …#3991
tobymao merged 2 commits intoSQLMesh:mainfrom
z3z1ma:perf/only-use-subq-in-audit-if-needed

Conversation

@z3z1ma
Copy link
Contributor

@z3z1ma z3z1ma commented Mar 13, 2025

…in audit wo where.

Striaghtforward change which allows audits without where conditions added by the snapshot containing a time_column to reference the table directly which reduces reliance on black box engine optimizer behavior.

Resolves #3990

@tobymao
Copy link
Contributor

tobymao commented Mar 13, 2025

looks good, let's fix the build

@z3z1ma z3z1ma force-pushed the perf/only-use-subq-in-audit-if-needed branch from 51c127b to 4d1ba03 Compare March 13, 2025 21:14
@izeigerman
Copy link
Contributor

izeigerman commented Mar 14, 2025

Looks like this change causes an unexpected metadata update. Probably because we use the rendered audit query to compute the metadata hash. @z3z1ma an empty migration script here https://github.com/TobikoData/sqlmesh/tree/main/sqlmesh/migrations will help the test pass

@tobymao
Copy link
Contributor

tobymao commented Mar 14, 2025

once i merge mine it’ll have a migration, so don’t worry about it

@tobymao tobymao enabled auto-merge (squash) March 14, 2025 16:19
@tobymao tobymao merged commit c832db8 into SQLMesh:main Mar 14, 2025
18 of 19 checks passed
afzaljasani pushed a commit that referenced this pull request Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Audits expanding @this_model into a select * subquery is potentially inefficient

3 participants