Skip to content

Commit

Permalink
update readme profiling example
Browse files Browse the repository at this point in the history
  • Loading branch information
taniabogatsch committed Sep 26, 2024
1 parent 8351c03 commit d8ac697
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ check(err)

This section describes using the [DuckDB Profiling API](https://duckdb.org/docs/dev/profiling.html).
DuckDB's profiling information is connection-local.
The following example walks you through the necessary steps to obtain the `ProfilingInformation` type, which contains all available metrics.
The following example walks you through the necessary steps to obtain the `ProfilingInfo` type, which contains all available metrics.
Please refer to the [DuckDB documentation](https://duckdb.org/docs/dev/profiling.html) on configuring and collecting specific metrics.

- First, you need to obtain a connection.
- Then, you enable profiling for the connection.
- Now, for each subsequent query on this connection, DuckDB will collect profiling information.
- Optionally, you can turn off profiling at any point.
- Next, you execute the query for which you want to obtain profiling information.
- Finally, directly after executing the query, you use the underlying DuckDB connection to retrieve any available profiling information.
- Finally, directly after executing the query, retrieve any available profiling information.

For readability, we omit error handling in this example.
```Go
Expand All @@ -138,12 +138,7 @@ _, err = con.ExecContext(context.Background(), `PRAGMA enable_profiling = 'no_ou
_, err = con.ExecContext(context.Background(), `PRAGMA profiling_mode = 'detailed'`)

res, err := con.QueryContext(context.Background(), `SELECT 42`)

var info ProfilingInfo
err = con.Raw(func(driverCon any) error {
info, err = GetProfilingInfo(driverCon)
return err
})
info, err := GetProfilingInfo(con)
err = res.Close()

_, err = con.ExecContext(context.Background(), `PRAGMA disable_profiling`)
Expand Down

0 comments on commit d8ac697

Please sign in to comment.