forked from duckdb/duckdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
703dfdb
commit aab179e
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
explain analyze select * from work where id%5 = 1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import duckdb | ||
import json | ||
|
||
duckdb_file = "db.duckdb" | ||
duckdb_query = "queries/q1.sql" | ||
|
||
con = duckdb.connect(duckdb_file) | ||
with open(duckdb_query, "r") as sql_file: | ||
sql_query = sql_file.read() | ||
|
||
con.sql("PRAGMA enable_profiling='json'") | ||
# print(sql_query) | ||
res = con.sql(sql_query).to_df() | ||
print(res['explain_value'][0]) | ||
res = (res['explain_value'][0]) | ||
|
||
res = json.loads(res) | ||
total_time = res["timing"] | ||
# seq_time = res["children"] | ||
print(f"Total Time: {total_time}") | ||
|
||
con.close() |