ClickHouse® is a real-time analytics DBMS
Go to file
Marek Vavruša ff73394124 PKCondition: infer index use with pk subexpression
By default only constraints explicitly matching
primary key expression (or expression wrapped in
a monotonic function) are eligible for part and
range selection. So for example, if index is:

(toStartOfHour(dt), UserID)

Then a query such as this resorts to full scan:

SELECT count() FROM t WHERE dt = now()

Intuitively, only parts with toStartOfHour(now())
could be selected, but it is less trivial to prove.
The primary key currently can be wrapped in a chain
of monotonic functions, so following would work:

toStartOfHour(dt) = toStartOfHour(now()) AND dt = now()

It must be however explicitly stated, if we wanted
to infer that we’d have to know the inverse function,
and prove that the inverse function is monotonic
on given interval. This is not practical as
there is no inverse function that for example undos
rounding, it isn’t strictly monotonic.

There are however functions that don’t transform
output range and preserve monotonicity on the
complete input range, such as rounding or casts
to a same or wider numeric type. This eliminates
the need to find inverse function, as no check for monotonicity over arbitrary interval is needed,
and thus makes this optimisation possible.
2017-07-09 17:13:51 +03:00
cmake Reorganize includes. part 1 (#921) 2017-06-23 23:22:35 +03:00
contrib Fix libunwind config 2017-06-27 11:53:56 +03:00
dbms PKCondition: infer index use with pk subexpression 2017-07-09 17:13:51 +03:00
debian Style [#CLICKHOUSE-2]. 2017-07-08 19:09:32 +03:00
docker fix ipv6 for server docker image 2017-07-05 17:11:22 +03:00
docs Added a note about testing versions [#CLICKHOUSE-2]. 2017-07-04 15:53:50 +03:00
libs Reorganize includes. part 1 (#921) 2017-06-23 23:22:35 +03:00
utils Reorganize includes. part 1 (#921) 2017-06-23 23:22:35 +03:00
website Fixed errors in readme [#CLICKHOUSE-3]. 2017-07-07 19:50:50 +03:00
.clang-format clang-format: AlignEscapedNewlinesLeft: true 2017-04-07 16:25:07 +03:00
.editorconfig Changed tabs to spaces in editor configs and in style guide [#CLICKHOUSE-3]. 2017-04-01 11:35:09 +03:00
.gitattributes Better stats on github [#METR-20000]. 2016-05-04 18:03:17 +03:00
.gitignore git: ignore vim cache files 2017-06-23 17:37:55 +03:00
.gitmodules CLICKHOUSE-2720: progress on website and reference (#886) 2017-06-20 17:19:03 +03:00
.vimrc Changed tabs to spaces in editor configs and in style guide [#CLICKHOUSE-3]. 2017-04-01 11:35:09 +03:00
AUTHORS CLICKHOUSE-2720: progress on website and reference (#886) 2017-06-20 17:19:03 +03:00
CMakeLists.txt Reorganize includes. part 1 (#921) 2017-06-23 23:22:35 +03:00
CONTRIBUTING.md CLICKHOUSE-2720: progress on website and reference (#886) 2017-06-20 17:19:03 +03:00
copy_headers.sh Reorganize includes. part 1 (#921) 2017-06-23 23:22:35 +03:00
docker-compose.yml Added docker-compose config 2017-02-16 22:00:25 +04:00
format_sources allow several <graphite> targets (#603) 2017-03-21 23:08:09 +04:00
format.sh Fool's day changed, continued [#CLICKHOUSE-3]. 2017-04-05 14:52:23 +03:00
LICENSE CLICKHOUSE-2720: progress on website and reference (#886) 2017-06-20 17:19:03 +03:00
MacOS.md Improved OS X build guides a little bit. 2016-12-07 11:21:53 +03:00
README.md Remove obsolete link 2017-05-24 01:19:41 +03:00
release more strict build script (fail on any command failure) 2017-06-08 09:02:27 +03:00
release_lib.sh simplify build script 2017-06-07 21:21:58 +03:00
release_test Removed useless code [#METR-20000]. 2016-06-10 17:42:05 +03:00

ClickHouse is an open-source column-oriented database management system that allows generating analytical data reports in real time.

Read more...