Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- MAX_STATEMENT_TIME = 1000 --in milliseconds
- *
- FROM table;
- <?php
- //make it real slow lol...
- $sql = "
- select *
- from information_schema.tables t1
- join information_schema.tables t2
- join information_schema.tables t3
- join information_schema.tables t4
- join information_schema.tables t5
- join information_schema.tables t6
- join information_schema.tables t7
- join information_schema.tables t8
- ";
- $mysqli = mysqli_connect('localhost', 'root', '');
- $mysqli->query($sql, MYSQLI_ASYNC | MYSQLI_USE_RESULT);
- $links = $errors = $reject = [];
- $links[] = $mysqli;
- // wait up to 1.5 seconds
- $seconds = 1;
- $microseconds = 500000;
- $timeStart = microtime(true);
- if (mysqli_poll($links, $errors, $reject, $seconds, $microseconds) > 0) {
- echo "query finished executing. now we start fetching the data rows over the network...n";
- $result = $mysqli->reap_async_query();
- if ($result) {
- while ($row = $result->fetch_row()) {
- // print_r($row);
- if (microtime(true) - $timeStart > 1.5) {
- // we exceeded our time limit in the middle of fetching our result set.
- echo "timed out while fetching resultsn";
- var_dump($mysqli->close());
- break;
- }
- }
- }
- } else {
- echo "timed out while waiting for query to executen";
- var_dump($mysqli->close());
- }
- select * from tbl_with_1billion_rows
- select sum(foo) from tbl_with_1billion_rows
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement