Skip to content
Pivot is in early development and is not production ready. See Project status.

Utility functions

Utility functions help inspect storage and control the running engine.

Function Result
format_bytes A byte count formatted as text.
drop_cache Number of cache entries evicted.
format_bytes(bytes)

Accepts an integer byte count and returns a VARCHAR using binary units, such as KiB and MiB. One KiB is 1024 bytes.

SELECT format_bytes(bytes) AS size
FROM (VALUES (1536::BIGINT)) AS input(bytes);
-- size: 1.5 KiB

Use it with system metadata:

SELECT name, format_bytes(bytes) AS size
FROM system.tables
ORDER BY bytes DESC;
drop_cache()

Takes no arguments. Clears Pivot’s caches, including compressed and decompressed data. Returns a BIGINT count of entries evicted.

SELECT drop_cache() AS entries_dropped;

The result depends on the cache contents at the time of the call.