Skip to content

Add SUBSAMPLE keyword documentation - #424

Open
javier wants to merge 18 commits into
mainfrom
jv/subsample_lbbt
Open

javier wants to merge 18 commits into
mainfrom
jv/subsample_lbbt

Conversation

@javier

@javier javier commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • New SQL reference page for the SUBSAMPLE clause - time-series downsampling that selects real rows (no interpolation)
  • Covers five algorithms: LTTB (shape-preserving), M4 (pixel-accurate min/max envelope), MinMax (lightweight envelope), uniform (take n elements evenly spaced), and cadence (take each n element, with optional random offset)
  • Includes gap-preserving LTTB variant with visual comparison
  • SVG diagrams for each algorithm using QuestDB color palette with dark/light mode support
  • Runnable examples on fx_trades demo dataset
  • Added cairo.sql.subsample.max.rows to configuration reference
  • Added SUBSAMPLE to sidebar under SELECT, after SAMPLE BY
  • Generator script at scripts/gen_subsample_svgs.py for rebuilding diagrams

Dependencies

New SQL reference page for the SUBSAMPLE clause covering LTTB, M4,
and MinMax downsampling algorithms with SVG diagrams, runnable
examples on fx_trades, gap-preserving LTTB, and configuration
reference.
@github-actions

github-actions Bot commented Apr 22, 2026

Copy link
Copy Markdown

🚀 Build success!

Latest successful preview: https://preview-424--questdb-documentation.netlify.app/docs/

Commit SHA: ba17488

📦 Build generates a preview & updates the link on each commit.

javier and others added 12 commits April 23, 2026 01:04
Avoid stretching all doc images by targeting only
img[src*="/subsample/"] instead of article img.
Split gap SVG into three separate charts with individual legends.
Add small gap to dataset to illustrate threshold behavior.
Use QuestDB color palette (pink lines, cyan titles, gray dots).
Match inline SQL examples to chart storytelling (24 hourly bars).
Add boundary markers distinguishing gaps from bucket boundaries.
Tweak dataset so M4 visibly outperforms MinMax (late spike with
pullback). Explain envelope, triangle method, and first/last
advantage for users unfamiliar with downsampling.
Move gap-preserving LTTB right after LTTB. Add uniform (evenly
spaced rows) and cadence (every Nth row with optional random
offset) sections. Update syntax block and comparison table.
Add uniform (evenly spaced) and cadence (every Nth row) sections
with SVG diagrams. Move gap-preserving LTTB under LTTB heading.
Reorder MinMax before M4. Add relative cost row to comparison table.
Add uniform, cadence, and gap-preserving LTTB to the chart-ready
examples section. Make DECLARE example demoable. Replace Grafana
reference with generic programmatic integration.
Resolve conflict from deleted _cairo.config.json by adding
cairo.sql.subsample.max.rows to cairo-engine.md in epigraph format.
javier and others added 5 commits September 21, 2026 10:04
Correct the source-row guarantee, designated timestamp requirement, output ordering, NULL handling, LTTB output count and gap allocation, M4 and MinMax gap and sizing claims, uniform and cadence edge cases, and the execution and memory model. Update cairo.sql.subsample.max.rows wording and mark the gap-detect diagram's line break as client-rendered.
Add the sdt(valueColumn, compdev) method: compression deviation tolerance, data-dependent output count, swinging-door mechanism, 2 * compdev reconstruction bound, NULL run boundaries, timestamp-gap behavior, query shape restrictions, and memory behavior. Add a static chart, a gap example chart, and the swinging-door animation. Show where SUBSAMPLE goes in a SELECT statement. State that cairo.sql.subsample.max.rows applies to lttb, m4, minmax, uniform, and cadence, and not to sdt.
Add a SUBSAMPLE window functions category to the window-function reference with cadence, lttb, m4, minmax, sdt, and uniform: signatures, the Boolean keep flag, argument validation, ordering, framing, partition, and NULL rules, and an outer-filter example each. Add a window-function form section to the SUBSAMPLE page explaining the two interfaces and when to use each. List the six functions in the window functions quick reference and correct the frame explanation. Rename the reference page's Examples section to Window function examples, keeping its anchor.
Add September 2026 changelog entries for the SUBSAMPLE page, the SUBSAMPLE window functions category, and cairo.sql.subsample.max.rows. Switch the outer-filter pattern to fx_trades with the demo column names and tag it as a demo query. Link the SUBSAMPLE page to the configuration reference instead of repeating the property's default, and link to the window functions section from See also.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant