docs: document the optional count in SAMPLE BY - #530
Merged
Conversation
SAMPLE BY accepts a bare unit, where the count defaults to 1, but this was never written down. Also renames the syntax placeholder, which used n, the same letter as the nanosecond unit listed right below it.
|
🚀 Build success! Latest successful preview: https://preview-530--questdb-documentation.netlify.app/docs/ Commit SHA: 5aebf2c
|
tris0laris
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SAMPLE BYaccepts a bare unit, where the count defaults to1, soSAMPLE BY handSAMPLE BY 1hare the same query. That has never been documented. Prompted by questdb/questdb#7391, which fixedwas the last unit that did not accept the bare form.The syntax now reads
SAMPLE BY [count]unit, with the default spelled out, plus the two constraints worth knowing: the count must be a positive integer, and no space is allowed before the unit.Also renames the syntax placeholder. It was
n, which is the nanosecond unit listed in the table immediately below, and making the count optional would have made that collision easier to trip over.Verified against a local instance: all ten units accept the bare form and return result sets identical to the explicit
1<unit>form.