-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect-pgsql-raw.php
More file actions
34 lines (25 loc) · 934 Bytes
/
select-pgsql-raw.php
File metadata and controls
34 lines (25 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* This file is part of the Makise-Co Postgres Client
* World line: 0.571024a
*
* (c) Dmitry K. <coder1994@gmail.com>
*/
declare(strict_types=1);
require_once dirname(__DIR__) . '/vendor/autoload.php';
require_once 'random_data.php';
Swoole\Coroutine\run(function () {
$handle = pg_connect(
"host=127.0.0.1 port=5434 dbname=makise user=makise password=el-psy-congroo application_name='Makise Postgres Client Benchmark' client_encoding=utf8 options='-ctimezone=UTC -csearch_path=public'"
);
$start = microtime(true);
for ($i = 0; $i < 100; $i++) {
$result = pg_exec($handle, 'SELECT * FROM test');
while ($row = pg_fetch_assoc($result)) {
}
}
$end = microtime(true);
$total = $end - $start;
printf("Execution time for Pgsql (raw): %f secs\n", $total);
printf("Peak memory usage for Pgsql (raw): %.2f kb\n", memory_get_peak_usage() / 1024);
});