Profiling database queries in Qcodo
This page is basically the same as "Performing Custom SQL Queries",
albeit with turned on collection and display of profiling data.
Gathering profiling information
- "profiling" data connection parameter - it is the main switch which controls collection of
profiling data, each database connection can have this parameter set independently.
- EnableProfiling* method - you can call this function anywhere in the script to start harvesting data.
- DisableProfiling* method, likewise this function stops the data collection
Displaying profiling information
- QApplication::DisplayProfilingInfo() -
This function displays helpful development info like queries sent to database and memory usage.
By default if called it only shows itself if database profiling is enabled in any configured database connections.
You can force it to show regardless of profiling by invoking it with argument "true":
QApplication::DisplayProfilingInfo(true);
This way you can monitor qcodo memory usage more accurately, as collecting database profiling information
tends to noticeable bigger memory consumption.
- OutputProfiling* - displays the database profiling results, plus a link which will popup the details of the profiling.
*There are methods of
QDatabase object.
When using
MySql version 5.0.37 or later profiling page also contains execution
time of each query.
This information is returned by database, it is not measured by PHP so it's more credible.
Ad Hoc Query: Selecting the Projects, their managers and team member count
ACME Payment Sm 2, managed by Karen Wolfe (with 7 team members)
ACME Website Redesign, managed by Karen Wolfe (with 5 team members)
Blueman Industrial Site Architecture, managed by John Doe (with 5 team members)
State College HR System, managed by Mike Ho (with 6 team members)
Ad Hoc NonQuery: Updating Project #3's budget to 2500
Updated. (Use
View Source above to see the code for this)
Custom Load Query: Select all Projects with Budgets over $5000, ordered by Descending Budget
State College HR System has a budget of $80500
ACME Website Redesign has a budget of $9560
ACME Payment Sm 2 has a budget of $5125
Qcodo Query: Select all Projects which have a Budget over $5000 and under $10000, ordered by Descending Budget
ACME Website Redesign has a budget of $9560
ACME Payment Sm 2 has a budget of $5125
PROFILING INFORMATION FOR DATABASE CONNECTION #1: 5 queries performed.
click here to view profiling detailmemory_get_peak_usage: 5.0 MB / 96M
max_execution_time: 180 s
max_input_time: 180 s
upload_max_filesize: 128M