Introduction
Welcome all. When working on web application management, I often encounter a problem that I have never solved with my current knowledge. In my applications, most data retrieval processes are long-lived due to complex queries and large amounts of data. In fact, the latency for retrieving data through PHP is largely consumed by QUERY EXECUTION (in most cases). Suppose we have this general situation.

Question
At this point, my question is: is there a solution in order to find out at what point in the query execution process arrived, and then trace the request for my [PROGRESS QUERY%]?
My decision
So far, the solution I have used is the following: "Request Time History"
, , , .
, , , , , , , [ QUERY%].
: ( )
HTML
<button type="button" id="runQuery" data-seconds="500">Get Data</button>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">
</div>
</div>
JAVASCRIPT
$("#runQuery").on("click", function() {
var currentSeconds = 0;
var totalSeconds = parseFloat($(this).data("seconds"));
var $progressBar = $(".progress-bar");
var progressPercentage = 0;
var execution;
$.ajax({
url: "scriptForQueryExecution.php", type: "POST", beforeSend: function() {
execution = setInterval(function() {
progressPercentage = currentSeconds / totalSeconds * 100;
$progressBar.css("width", progressPercentage + '%').attr("aria-valuenow", progressPercentage);
currentSeconds++;
}, 1000);
}, success: function() {
$progressBar.css("width", '100%').attr("aria-valuenow", 100);
clearInterval(execution);
}
});
});