Documentation
Cursor
Environment Aware Query Optimization in Cursor
Problem
As query volume and data size grow, generic SQL generated by Cursor becomes inefficient. Without awareness of the specific DWH environment, queries may ignore platform specific best practices, leading to slower performance and higher costs.
Solution
Force Cursor to optimize queries based on your actual data warehouse. By injecting up to date documentation into the context and using it to create rules, Cursor generates and improves queries according to environment specific best practices, enabling faster, cheaper, and more reliable query execution.
Prompt
Create a Cursor Rule in .cursor/rules/snowflake_query_optimization.mdc based strictly on the attached @Snowflake documentation.
>
> 1. Instructional Anchor: Use the provided @Snowflake docs as the primary source of truth. Extract specific optimization techniques mentioned there (e.g., Search Optimization Service, Dynamic Tables, or Warehouse Sizing).
> 2. Rule Metadata:
> - Description: Snowflake query performance and cost optimization standards.
> - Globs: Target all SQL files (**/*.sql) and Python analysis scripts (**/analysis/*.py).
> 3. Requirements:
> - Translate the 'Best Practices' from the docs into a 'Mandatory Checklist' for the AI to follow.
> - Include a section for 'Performance Monitoring' based on the docs' guidance on using Query Profiles.
> 4. Formatting: Ensure the output uses the .mdc format with frontmatter and clear markdown headings.