You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE TABLE default.toy
(
day Date,
hour Int8,
info String
) ENGINE = MergeTree(day, (day, hour), 1024)
and, batch inserting data every hour. from the doc I can drop a partition of a month, but if there is one hour dirty data inserted, how to delete this hour's data? I don't want to drop all partition of that month.
can i do subpartition by day, by hour?
You can use tables with suffix based on hour, as stage tables, and insert data in specific table. Selecting using Merge table type as virtual view to all tables based on hour.
Eg. use script to create 365 x 24 tables in stage database, like stage.table_yyyymmdd_hh and use Merge(stage, '^table') to select data.
That way you will be able to drop single table based on hour.
What are the performance implications of doing queries spanning a month over a merge table that has 365 x 24 tables under it? The docs for merge engine say queries are parallel so there will be 30 x 24 queries run at the same time?
What are the performance implications of doing queries spanning a month over a merge table that has 365 x 24 tables under it?
Every query, even simple one, will require to do at least 365 * 24 * num_used_columns disk seeks.
For short-running queries this will be very expensive.
The docs for merge engine say queries are parallel so there will be 30 x 24 queries run at the same time?
Tables are processed in parallel but with limited number of threads. There will be max_threads (default = number of physical CPU cores) and each of them will process some subset of all tables.
Activity
alexey-milovidov commentedon Jul 29, 2016
There is no way to delete data with granularity less than partitions, and it is not possible to define custom partitions rather than month.
Both features are possible to implement and we have plans for it (not in near perspective, definitely later than Q3).
andrea-s commentedon Jul 31, 2016
What about selecting all the data that we need in a new table, dropping the old one, and selecting it back? Would that be safe, Alexey?
alexey-milovidov commentedon Jul 31, 2016
Yes, it is safe
(create a new table, do INSERT SELECT of all "right" data into it, and then do DROP, RENAME).
goranc commentedon Nov 21, 2016
You can use tables with suffix based on hour, as stage tables, and insert data in specific table. Selecting using Merge table type as virtual view to all tables based on hour.
Eg. use script to create 365 x 24 tables in stage database, like stage.table_yyyymmdd_hh and use Merge(stage, '^table') to select data.
That way you will be able to drop single table based on hour.
daledude commentedon Apr 1, 2017
What are the performance implications of doing queries spanning a month over a merge table that has 365 x 24 tables under it? The docs for merge engine say queries are parallel so there will be 30 x 24 queries run at the same time?
alexey-milovidov commentedon Apr 7, 2017
Every query, even simple one, will require to do at least 365 * 24 * num_used_columns disk seeks.
For short-running queries this will be very expensive.
Tables are processed in parallel but with limited number of threads. There will be
max_threads(default = number of physical CPU cores) and each of them will process some subset of all tables.harlinb commentedon Nov 17, 2017
Potentially solved by #1482
DOCAPI-6422: EN review, RU translation. Docs for adaptive index granu…
Support expr on broadcast (ClickHouse#64)