From 88953ecdd91f3fa3944947707550edd2ae721901 Mon Sep 17 00:00:00 2001 From: Eric Fu Date: Mon, 23 Dec 2024 17:59:35 +0800 Subject: [PATCH] Update temporal-filters.mdx Signed-off-by: Eric Fu --- processing/sql/temporal-filters.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/processing/sql/temporal-filters.mdx b/processing/sql/temporal-filters.mdx index e79be010..dd487a9b 100644 --- a/processing/sql/temporal-filters.mdx +++ b/processing/sql/temporal-filters.mdx @@ -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.