* Maintain per-thread timer_id rather than create/delete frequently
The QueryProfiler will frequently create/delete timer_id globally, which
will result in heavy kernel lock contention.
The idea is to maintain thread-local timer_id. Before create the
timer_id, it should check whether there is a timer_id already. And we
could stop the timer by timer_settime() rather than delete the timer_id
with timer_delete().
Apply the patch and run clickbench on latest 65d671b7c7 ClickHouse with
SPR 112 x 2 vCPUs. Query 4, 0, 5, 3, 15, 32 have 17.5%, 14.4%, 8.3%, 7.9%,
7.1%, 5.8% performance gain. The overall geomean has got 2.5%
performance gain.
Signed-off-by: Jiebin Sun <jiebin.sun@intel.com>
* Pack the timer and delete the timer_id when thread terminates
Pack the timer and related methods into the class. Delete the timer_id
when the thread terminates.
According to the issue (ClickHouse#49965),
all of the SSB queries benefit from this optimization, some have even got
improved by ~30% and the overall QPS could be significantly improved by ~18%.
Signed-off-by: Jiebin Sun <jiebin.sun@intel.com>
* Update src/Common/QueryProfiler.cpp
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
* Update src/Common/QueryProfiler.cpp
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
* Fix the review issue of QueryProfiler Timer from PR
https://github.com/ClickHouse/ClickHouse/pull/48778.
Signed-off-by: Jiebin Sun <jiebin.sun@intel.com>
* Update src/Common/QueryProfiler.cpp
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
* Add two separate CurrentMetrics for created and active timers
in QueryProfiler.
Signed-off-by: Jiebin Sun <jiebin.sun@intel.com>
---------
Signed-off-by: Jiebin Sun <jiebin.sun@intel.com>
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
Co-authored-by: Nikita Taranov <nikita.taranov@clickhouse.com>
Updated PostgreSQL documentation to better show example of using PostgreSQL() table engine for SELECT and INSERT, vs. copying data via postgresql() table function for copying data into ClickHouse