Commit Graph

841 Commits

Author SHA1 Message Date
Antonio Andelic
f72e509b3b
Merge pull request #38052 from amosbird/join_regression_fix
Fix significant join performance regression
2022-06-17 19:55:33 +02:00
Robert Schulze
a0d936cc9f
Small follow-up for FPC codec
- add paper reference + doxygen

- remove endianness handling (ClickHouse assumes little endian)

- documentation

- other minor stuff
2022-06-15 14:21:28 +02:00
mergify[bot]
2cb9579234
Merge branch 'master' into join_regression_fix 2022-06-15 11:53:42 +00:00
Nikita Taranov
c8afeafe0e
More parallel execution for queries with FINAL (#36396) 2022-06-15 12:44:20 +02:00
Robert Schulze
9794098ebb
Merge pull request #37553 from koloshmet/fpc_codec
FPC Codec for floating point data
2022-06-15 12:03:41 +02:00
Maksim Kita
dc2e117cce UnaryLogicalFunctions improve performance using dynamic dispatch 2022-06-14 17:30:11 +02:00
Amos Bird
9a6e6ccfaf
Fix significant join performance regression 2022-06-14 21:14:18 +08:00
Maksim Kita
daa128f378 Fixed performance tests 2022-06-13 13:31:02 +02:00
Maksim Kita
1247ba1b01 Hierarchical dictionaries performance test fix 2022-06-13 12:31:39 +02:00
Mikhail Guzov
092a00d95a
Merge branch 'ClickHouse:master' into fpc_codec 2022-06-11 21:24:06 +03:00
Maksim Kita
3a0e7b662c
Merge pull request #37954 from kitaisreal/normalize-utf8-performance-tests-fix
Normalize UTF8 performance test fix
2022-06-11 15:23:06 +02:00
mergify[bot]
a44590ea84
Merge branch 'master' into normalize-utf8-performance-tests-fix 2022-06-09 14:33:29 +00:00
Maksim Kita
5009374036 Normalize UTF8 performance test fix 2022-06-09 15:35:53 +02:00
Nikita Taranov
0a9d8398d8 impl 2022-06-04 19:14:38 +00:00
Robert Schulze
b3b0716b32
Merge pull request #37544 from ClickHouse/cached_patterns
Cache compiled regexps when evaluating non-const needles
2022-06-01 19:55:25 +02:00
Robert Schulze
81318e07d6
Try to fix performance test results 2022-06-01 11:53:37 +02:00
Anton Popov
20e319d67a
Merge pull request #37666 from CurtizJ/optimize-coalesce
Optimize function `COALESCE` with two arguments
2022-05-31 23:48:13 +02:00
Anton Popov
30f8eb800a optimize function coalesce with two arguments 2022-05-30 22:29:35 +00:00
Robert Schulze
ad12adc31c
Measure and rework internal re2 caching
This commit is based on local benchmarks of ClickHouse's re2 caching.

Question 1: -----------------------------------------------------------
Is pattern caching useful for queries with const LIKE/REGEX
patterns? E.g. SELECT LIKE(col_haystack, '%HelloWorld') FROM T;

The short answer is: no. Runtime is (unsurprisingly) dominated by
pattern evaluation + other stuff going on in queries, but definitely not
pattern compilation. For space reasons, I omit details of the local
experiments.

(Side note: the current caching scheme is unbounded in size which poses
a DoS risk (think of multi-tenancy). This risk is more pronounced when
unbounded caching is used with non-const patterns ..., see next
question)

Question 2: -----------------------------------------------------------
Is pattern caching useful for queries with non-const LIKE/REGEX
patterns? E.g. SELECT LIKE(col_haystack, col_needle) FROM T;

I benchmarked five caching strategies:
1. no caching as a baseline (= recompile for each row)
2. unbounded cache (= threadsafe global hash-map)
3. LRU cache (= threadsafe global hash-map + LRU queue)
4. lightweight local cache 1 (= not threadsafe local hashmap with
   collision list which grows to a certain size (here: 10 elements) and
   afterwards never changes)
5. lightweight local cache 2 (not threadsafe local hashmap without
   collision list in which a collision replaces the stored element, idea
   by Alexey)

... using a haystack of 2 mio strings and
A). 2 mio distinct simple patterns
B). 10 simple patterns
C)  2 mio distinct complex patterns
D)  10 complex patterns

Fo A) and C), caching does not help but these queries still allow to
judge the static overhead of caching on query runtimes.

B) and D) are extreme but common cases in practice. They include
queries like "SELECT ... WHERE LIKE (col_haystack, flag ? '%pattern1%' :
'%pattern2%'). Caching should help significantly.

Because LIKE patterns are internally translated to re2 expressions, I
show only measurements for MATCH queries.

Results in sec, averaged over on multiple measurements;

1.A): 2.12
  B): 1.68
  C): 9.75
  D): 9.45

2.A): 2.17
  B): 1.73
  C): 9.78
  D): 9.47

3.A): 9.8
  B): 0.63
  C): 31.8
  D): 0.98

4.A): 2.14
  B): 0.29
  C): 9.82
  D): 0.41

5.A) 2.12 / 2.15 / 2.26
  B) 1.51 / 0.43 / 0.30
  C) 9.97 / 9.88 / 10.13
  D) 5.70 / 0.42 / 0.43
(10/100/1000 buckets, resp. 10/1/0.1% collision rate)

Evaluation:

1. This is the baseline. It was surprised that complex patterns (C, D)
   slow down the queries so badly compared to simple patterns (A, B).
   The runtime includes evaluation costs, but as caching only helps with
   compilation, and looking at 4.D and 5.D, compilation makes up over 90%
   of the runtime!

2. No speedup compared to 1, probably due to locking overhead. The cache
   is unbounded, and in experiments with data sets > 2 mio rows, 2. is
   the only scheme to throw OOM exceptions which is not acceptable.

3. Unique patterns (A and C) lead to thrashing of the LRU cache and very
   bad runtimes due to LRU queue maintenance and locking. Works pretty
   well however with few distinct patterns (B and D).

4. This scheme is tailored to queries B and D where it performs pretty
   good. More importantly, the caching is lightweight enough to not
   deteriorate performance on datasets A and C.

5. After some tuning of the hash map size, 100 buckets seem optimal to
   be in the same ballpark with 10 distinct patterns as 4. Performance
   also does not deteriorate on A and C compared to the baseline.
   Unlike 4., this scheme behaves LRU-like and can adjust to changing
   pattern distributions.

As a conclusion, this commit implementes two things:

1. Based on Q1, pattern search with const needle no longer uses
   caching. This applies to LIKE and MATCH + a few (exotic) other SQL
   functions. The code for the unbounded caching was removed.

2. Based on Q2, pattern search with non-const needles now use method 5.
2022-05-30 20:00:35 +02:00
Alexey Milovidov
9e3242f186
Merge pull request #37617 from CurtizJ/aggregation-sparse-columns
Better performance with sparse columns in aggregate functions
2022-05-29 09:36:07 +03:00
Anton Popov
c39d95e2e6 add perf test 2022-05-28 12:56:38 +00:00
Alexey Milovidov
86afa3a245
Merge pull request #37502 from ClickHouse/array_norm_dist_fixes
Renamed arrayXXNorm/arrayXXDistance functions to XXNorm/XXDistance and fixed some overflow cases
2022-05-27 00:56:29 +03:00
koloshmet
7e69779575 added fpc codec to float perftest 2022-05-26 22:32:56 +03:00
Maksim Kita
3a92e61827
Merge pull request #37148 from kitaisreal/dictionary-get-descendants-performance-improvement
Dictionary getDescendants performance improvement
2022-05-26 12:29:17 +02:00
Maksim Kita
bee3c30f66
Merge pull request #37524 from kitaisreal/geo-distance-functions-improve-performance
Geo distance functions improve performance
2022-05-25 22:40:40 +02:00
Alexander Gololobov
168b47d0ad Use same norm and distance function names for tuples and arrays 2022-05-25 22:39:59 +02:00
Maksim Kita
45da28ecae Improve performance of geo distance functions 2022-05-25 14:22:22 +02:00
Maksim Kita
3c0c322d7c
Merge pull request #37480 from kitaisreal/dynamic-dispatch-infrastructure-improvements
Dynamic dispatch infrastructure style fixes
2022-05-24 18:13:53 +02:00
Maksim Kita
e6e4b2826d Dynamic dispatch infrastructure style fixes 2022-05-24 14:25:29 +02:00
Kruglov Pavel
6c9a524f6b
Merge pull request #37192 from Avogar/formats-with-names
Improve performance and memory usage for select of subset of columns for some formats
2022-05-24 13:28:14 +02:00
avogar
3651ef93fe Fix performance test 2022-05-23 17:42:13 +00:00
Alexander Gololobov
d0f5551c9f Parameterized with norm kind 2022-05-23 18:27:41 +02:00
Alexander Gololobov
2658a9eeeb Test with max_threads=1 2022-05-23 18:06:07 +02:00
Maksim Kita
94772f9cfc Added performance tests 2022-05-23 14:43:13 +02:00
Alexander Gololobov
70cc27ecac Test with different element types 2022-05-23 14:08:15 +02:00
Alexander Gololobov
7897a5bac7 Perf test for Norm and Distance fuctions for arrays and tuples 2022-05-23 10:18:24 +02:00
avogar
566d1b15fd Merge branch 'master' of github.com:ClickHouse/ClickHouse into formats-with-names 2022-05-20 13:54:52 +00:00
Maksim Kita
beb34e7062 Improve performance of unary arithmetic functions 2022-05-17 13:53:20 +02:00
avogar
cef13c2c02 Allow to skip unknown columns in Native format 2022-05-13 14:27:15 +00:00
avogar
b17fec659a Improve performance and memory usage for select of subset of columns for some formats 2022-05-13 13:51:28 +00:00
Maksim Kita
437d70d4da Fixed tests 2022-05-11 21:59:51 +02:00
Maksim Kita
837f2e8b9c Update performance test 2022-05-11 21:59:51 +02:00
Maksim Kita
ea8ce3140a Fixed tests 2022-05-11 21:59:51 +02:00
Maksim Kita
d85d72e5ad Added performance tests 2022-05-11 21:59:51 +02:00
Alexey Milovidov
5a750d3305 Merge branch 'master' into revert-group-array-sorted 2022-05-05 00:51:01 +02:00
Alexey Milovidov
c95591f294
Merge pull request #36841 from ClickHouse/fix-performance-test-5
Remove "preconditions" from performance tests (overengineering, unneeded feature)
2022-05-02 12:22:56 +03:00
Alexey Milovidov
7cc64d40a6 Remove tags as well 2022-05-02 02:35:44 +02:00
Alexey Milovidov
88826e2da5 Remove "preconditions" from performance tests (overengineering, unneeded feature) 2022-05-02 02:33:22 +02:00
Alexey Milovidov
2691261aa2 Fix performance test 2022-05-02 02:21:19 +02:00
Alexey Milovidov
d6c0de0d40 Revert "Merge pull request #34055 from palegre-tiny/groupSortedArray"
This reverts commit f055d7b692, reversing
changes made to 4ec3c35e14.
2022-04-30 12:29:23 +02:00