Add a Connection decorator to proxy the fetch() and execute() methods, and use Postgres/MySQL EXPLAIN queries to log query performance information to a PSR LoggerInterface instance.
First version can simply log this information - an improved future version could perform some analysis/filtering on the performance data, for example highlighting log-entries that indicate sequential table scans and other potential issues.
It should avoid logging redundant queries - e.g. avoid doing multiple analysis queries when the same SQL query template is executed multiple times. (Consider using debug_backtrace() to group queries by call site.)
It should report the number of times the same SQL query template was executed.
It should measure and report the total and average time (in milliseconds) for each SQL query template.
Add a
Connection
decorator to proxy thefetch()
andexecute()
methods, and use Postgres/MySQLEXPLAIN
queries to log query performance information to a PSRLoggerInterface
instance.https://www.postgresql.org/docs/9.4/static/sql-explain.html
http://dev.mysql.com/doc/refman/5.7/en/explain.html
First version can simply log this information - an improved future version could perform some analysis/filtering on the performance data, for example highlighting log-entries that indicate sequential table scans and other potential issues.
It should avoid logging redundant queries - e.g. avoid doing multiple analysis queries when the same SQL query template is executed multiple times. (Consider using
debug_backtrace()
to group queries by call site.)It should report the number of times the same SQL query template was executed.
It should measure and report the total and average time (in milliseconds) for each SQL query template.
Add documentation.