In postgres, if I define a function as sql (not PL/pgSQL), will the planner inline…
- User
In postgres, if I define a function as sql (not PL/pgSQL), will the planner inline it/see through it?
Assistant
Yes, PostgreSQL can inline SQL functions (not PL/pgSQL) under certain conditions. When a function is inlined, the planner essentially replaces the function call with its body, allowing it to optimize the entire query as a whole.
For a SQL function to be inlined, it must meet these criteria:
- Language must be SQL - not PL/pgSQL or other procedural languages
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.