mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
ClickHouse® is a real-time analytics DBMS
ff73394124
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. |
||
---|---|---|
cmake | ||
contrib | ||
dbms | ||
debian | ||
docker | ||
docs | ||
libs | ||
utils | ||
website | ||
.clang-format | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
.gitmodules | ||
.vimrc | ||
AUTHORS | ||
CMakeLists.txt | ||
CONTRIBUTING.md | ||
copy_headers.sh | ||
docker-compose.yml | ||
format_sources | ||
format.sh | ||
LICENSE | ||
MacOS.md | ||
README.md | ||
release | ||
release_lib.sh | ||
release_test |
ClickHouse is an open-source column-oriented database management system that allows generating analytical data reports in real time.