Skip to content

Run MySQL checks on the server instead of copying the table - #1863

Open
Krrishkumar125 wants to merge 2 commits into
datacontract:mainfrom
Krrishkumar125:cursor/mysql-check-pushdown-a463
Open

Krrishkumar125 wants to merge 2 commits into
datacontract:mainfrom
Krrishkumar125:cursor/mysql-check-pushdown-a463

Conversation

@Krrishkumar125

Copy link
Copy Markdown

Fixes #1602.

datacontract test copied each MySQL table into DuckDB, then ran the checks on the copy. A MAX on a large table read every row first.

Each model is now a view over a read-only MySQL attachment. DuckDB runs the check and sends MySQL the filters and aggregates it can. Quality rules are still DuckDB SQL. A rule cannot call mysql_query or name the attached catalog, so it cannot use the credentials to read another table.

A check DuckDB cannot push, such as a count of nulls, still reads that column. It no longer copies every column before the query.

The new test reads MySQL's general log. Before this change the server received SELECT n, label FROM test.bulk_orders. After it, that contract receives SELECT MAX(n) and SELECT COUNT(*) ... WHERE n < 0. The existing MySQL checks still pass.

A MAX over bulk_orders still makes MySQL send every column of every row.
Each model is a view over a read-only attachment, and DuckDB sends the
aggregates it can. A quality rule still cannot call mysql_query.
Copilot AI balanced review requested due to automatic review settings November 27, 2026 11:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

This branch has not been deployed

No deployments
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.

MySQL query checks extremely slow and memory-intensive due to DuckDB materialization

2 participants