From d8ac697a36357ca8566a0b8e92ba36a3ea15add5 Mon Sep 17 00:00:00 2001 From: taniabogatsch <44262898+taniabogatsch@users.noreply.github.com> Date: Thu, 26 Sep 2024 13:26:54 +0200 Subject: [PATCH] update readme profiling example --- README.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index fe63d1e4..2ec80a2c 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ 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. @@ -127,7 +127,7 @@ Please refer to the [DuckDB documentation](https://duckdb.org/docs/dev/profiling - 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 @@ -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`)