NewsCrawler.org

Approximate statistics SQLite extension for Go (ncruces/go-sqlite3)

The approx package in the ncruces/go-sqlite3 library provides approximate aggregate functions for SQLite. It includes functions that estimate the number of distinct values using HyperLogLog[1], and functions that estimate quantiles and relative ranks using a REQ sketch[2].

Other functions return the approximate top K elements, with counts and sums, as JSON using a Frequent Items sketch built on Misra-Gries summaries[3]. Each sketch type has accumulate, combine and estimate functions, so partial sketch BLOBs can be merged and estimated later. The approx_sketch_info function returns summary statistics and error bounds for a sketch BLOB as JSON.

HyperLogLog sketch BLOBs follow the Aggregate Knowledge HLL Storage Specification. REQ sketches use high-rank accuracy mode, which gives priority to precision at the upper tail, such as p95, p99 and p99.9. At the median, the rank error matches typical KLL sketches[4], and at the lower tail it is at most 2x worse.

Repository ncruces/go-sqlite3 github.com

Go bindings for SQLite, a library that lets Go programs use the SQLite database, including an approx package of approximate aggregate functions.

Stars: 1,142Forks: 45License: MITUpdated:

Read the original pkg.go.devDiscussion

Sources

Published: First seen: Читать по-русски

Open as a page