Skip to content

docs(ASOF JOIN): Clarify timestamp control and precedence #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jerrinot
Copy link
Contributor

@jerrinot jerrinot commented Jun 9, 2025

Rework the ASOF JOIN timestamp documentation to address the common misuse of the timestamp(ts) syntax.

The guide now clarifies that the designated timestamp is inherited by default. The standard method for joining on a different column is to use an ORDER BY clause in a subquery, which implicitly sets a new timestamp for the join.

The timestamp(ts) syntax is now correctly framed as an expert-level performance hint, used only to assert a pre-sorted order on data that lacks a designated timestamp.

Copy link

github-actions bot commented Jun 9, 2025

🚀 Build success!

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

Commit SHA: a17d08a

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

Copy link
Collaborator

@goodroot goodroot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one!

Suggest:

  • Ditching Title Case with the Capitals - if we had a style guide, it'd say use Conversational case in titles.
  • I believe the queries are demo-able, and can be tagged such
  • A couple minor suggestions re: title length and header structure


:::caution
#### The Default Behavior: Implicit Timestamp Propagation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This title is slightly long.

Consider:

#### Default behaviour

As a default, QuestDB appies implicit timestamp propogation. This means that by default, an `ASOF JOIN` will...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to be verbose here since I saw people getting this wrong and explicitly marking a column as a designated timestamp


```questdb-sql
```questdb-sql title="ASOF JOIN with designated timestamp"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demo-able query?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately no:(
in fact, I found a bug while trying to find an equivalent demo-able query 😬


Example: Joining on `ingestion_time` instead of the default `trade_ts`

```questdb-sql title="ASOF JOIN with custom timestamp"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also demo-able?

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.

2 participants