Skip to content

Add SUBSAMPLE keyword documentation#424

Open
javier wants to merge 11 commits intomainfrom
jv/subsample_lbbt
Open

Add SUBSAMPLE keyword documentation#424
javier wants to merge 11 commits intomainfrom
jv/subsample_lbbt

Conversation

@javier
Copy link
Copy Markdown
Contributor

@javier javier commented Apr 22, 2026

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
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

🚀 Build success!

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

Commit SHA: 50db1af

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

javier and others added 10 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant