ProfilingSetupSQL returns the SQL statements that configure DuckDB profiling so the output is written to outputPath. These are session-scoped — DuckDB rejects `SET GLOBAL` for each one — so any caller that hands out fresh connections (e.g. after evictConnFromPool) must re-run them per connection.
(outputPath string)
| 19 | // caller that hands out fresh connections (e.g. after evictConnFromPool) |
| 20 | // must re-run them per connection. |
| 21 | func ProfilingSetupSQL(outputPath string) []string { |
| 22 | return []string{ |
| 23 | // 'json' enables profiling and selects JSON output (the format the |
| 24 | // control-plane parser expects). |
| 25 | "SET enable_profiling = 'json'", |
| 26 | // 'detailed' adds operator-level timings on top of the standard |
| 27 | // query-level latency / row counts. |
| 28 | "SET profiling_mode = 'detailed'", |
| 29 | // Default coverage is 'SELECT', which silently skips writing the |
| 30 | // profile file for INSERT / bare CREATE TABLE / etc. — see |
| 31 | // TestProfilingCoverageAllCoversNonSelect. |
| 32 | "SET profiling_coverage = 'ALL'", |
| 33 | "SET profiling_output = '" + outputPath + "'", |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | // ApplyProfilingSettings runs ProfilingSetupSQL against the given |
| 38 | // connection, writing profiles to ProfilingOutputPath. Use this for |
no outgoing calls