Skip to content

Commit

Permalink
perf: Swap the ordering of CROSS JOIN tables
Browse files Browse the repository at this point in the history
  • Loading branch information
tkaemming committed Jan 24, 2025
1 parent ab89d57 commit e93e3b4
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,13 @@ def _actors_inner_select_query(
SELECT
d.timestamp,
COUNT(DISTINCT actor_id) AS counts
FROM (
FROM {cross_join_select_query} e
CROSS JOIN (
SELECT
{date_to_start_of_interval} - {number_interval_period} AS timestamp
FROM
numbers(dateDiff({interval}, {date_from_start_of_interval} - {inclusive_lookback}, {date_to}))
) d
CROSS JOIN {cross_join_select_query} e
WHERE
e.timestamp <= d.timestamp + INTERVAL 1 DAY AND
e.timestamp > d.timestamp - {exclusive_lookback}
Expand Down

0 comments on commit e93e3b4

Please sign in to comment.