Rewrites table data files to match the current clustering order. Use this after setting clustering on a table that already contains data, or after many appends have fragmented the sort order.
DuckLake automatically sorts data during compaction based on the table's sort order (SET SORTED BY), so this function compacts files to re-sort.
See also
db_set_clustering() to configure clustering order, db_compact()
Examples
if (FALSE) { # \dontrun{
db_connect()
# Set clustering then recluster existing data
db_set_clustering(table = "events", columns = c("event_date"))
db_recluster(table = "events")
# Recluster with memory limit
db_recluster(table = "events", max_files = 100)
} # }