Skip to content

Commit

Permalink
Update temporal-filters.mdx (#156)
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Fu <[email protected]>
  • Loading branch information
fuyufjh authored Dec 24, 2024
1 parent 6118d52 commit fb431ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions processing/sql/temporal-filters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ CREATE SOURCE sales_source(...) with (connector = 'kafka', ...) FORMAT PLAIN ENC
CREATE MATERIALIZED VIEW sales AS
SELECT *
FROM sales_source
WHERE sale_date > NOW() - INTERVAL '1 week';
WHERE sale_date > NOW() - INTERVAL '7 days';
```

The temporal filter in this query is `sale_date > NOW() - INTERVAL '1 week'`. It filters the rows based on the `sale_date` column and checks if it is within one week of the current time or `NOW()`.
The temporal filter in this query is `sale_date > NOW() - INTERVAL '7 days'`. It filters the rows based on the `sale_date` column and checks if it is within one week of the current time or `NOW()`.

The following query returns all rows from the `user_sessions` table where the sum of the `last_active` timestamp and double the `session_timeout` duration is greater than the current timestamp, indicating active user sessions. This query could be used to clean up old user sessions from the database by deleting any rows that no longer satisfy the condition.

Expand Down

0 comments on commit fb431ed

Please sign in to comment.