Closed bobbingwide closed 3 years ago
I'm doing this to help you Mr L.
I've now added logic to report the saved queries, grouped by function. Example:
C:\apache\htdocs\wordpress\wp-content\plugins\oik-bwtrace\includes\oik-actions.php(350:0)
bw_trace_saved_queries_grouped_by_function(1)
37 0 2020-11-20T15:20:10+00:00 2.875893 0.000800
cf=shutdown 9917 354 964 10485760/12582912 256M Grouped by function
Function | Count | Elapsed
-------- | ----- | -------
Total | 354 | 1.4749894142151
Yoast\WP\Lib\ORM::execute | 259 | 1.2082939147949
add_option | 1 | 0.11339902877808
wp_insert_post | 2 | 0.030858039855957
...
The table is formatted using Markdown for easy insertion into GitHub issues.
Function | Count | Elapsed |
---|---|---|
Total | 354 | 1.4749894142151 |
Yoast\WP\Lib\ORM::execute | 259 | 1.2082939147949 |
add_option | 1 | 0.11339902877808 |
wp_insert_post | 2 | 0.030858039855957 |
This is now released in v3.2.1 on wordpress.org and oik-plugins. Closing
oik-bwtrace has an option to Trace 'shutdown' saved queries. When checked the MySQL queries are recorded in
$wpdb->queries
and the two reports are produced[bw_sql]
shortcodes, one per query.To make it easier to analyse the overall performance of the SQL queries that are run we need to extract the data into a spreadsheet. It would be nice to have another report, sorted by longest execution time, and showing cumulative execution time. It should be formatted suitable for loading directly into a spreadsheet as a CSV file.
eg given this subset
the summary report would be
Once loaded into the spreadsheet the data can be sorted and filtered.
Proposed solution
saved_queries
array.