import { SelectQuery } from '../models/SelectQuery'; /** * Captures the schema metadata required to safely evaluate LEFT JOIN removal. */ export interface SchemaTableInfo { /** The fully qualified table name that appears in SQL references. */ name: string; /** Column names that exist on the table for any schema validation steps. */ columns: string[]; /** * Unique key declarations for the table. * Each entry is an array of column names that together form a uniqueness constraint. */ uniqueKeys: string[][]; } /** Ordered set of table metadata consumed by the optimizer. */ export type SchemaInfo = SchemaTableInfo[]; /** * Removes LEFT JOIN clauses from the provided query when AST references prove the join target is unused and schema metadata certifies the join column is unique. */ export declare const optimizeUnusedLeftJoins: (query: SelectQuery, schemaInfo: SchemaInfo) => SelectQuery; /** * Applies the unused left join optimizer until no further joins can be trimmed, ensuring cascading removals stabilize. */ export declare const optimizeUnusedLeftJoinsToFixedPoint: (query: SelectQuery, schemaInfo: SchemaInfo) => SelectQuery; /** * Removes unused SELECT-only CTEs from the query when AST references confirm they are never consumed. */ export declare const optimizeUnusedCtes: (query: SelectQuery) => SelectQuery; /** * Repeatedly prunes unused CTEs until a fixed point is reached so chained removals complete deterministically. */ export declare const optimizeUnusedCtesToFixedPoint: (query: SelectQuery) => SelectQuery;