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 1 commit 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: 62d4145

📦 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

@@ -327,30 +327,86 @@ Result:

</div>

### Timestamp considerations
### How ASOF JOIN Uses Timestamps
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
### How ASOF JOIN Uses Timestamps
### How ASOF JOIN uses timestamps


:::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...


```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?

```

#### The Standard Override Method: Using ORDER BY
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#### The Standard Override Method: Using ORDER BY
#### Using ORDER BY


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?

ASOF JOIN quotes ON (symbol);
```

#### Using the timestamp() Syntax
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#### Using the timestamp() Syntax
#### Using the timestamp() syntax

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