future-toothbrush-54596
11/25/2022, 2:36 AMfuture-toothbrush-54596
11/25/2022, 2:36 AMSELECT
DISTINCT *
FROM
(
SELECT
id,
FIRST_VALUE(`column_a` IGNORE NULLS) OVER (
PARTITION BY id
ORDER BY
received_at DESC ROWS BETWEEN UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWING
) AS `column_a`,
FIRST_VALUE(`column_b` IGNORE NULLS) OVER (
PARTITION BY id
ORDER BY
received_at DESC ROWS BETWEEN UNBOUNDED PRECEDING
AND UNBOUNDED FOLLOWING
) AS `column_b`
FROM
(
(
SELECT
id,
`column_a`,
`column_b`
FROM
`rudderstack`.`users_view`
WHERE
(
id in (
SELECT
user_id
FROM
`rudderstack`.`identifies`
WHERE
_PARTITIONTIME = TIMESTAMP('2022-11-24')
AND user_id IS NOT NULL
AND loaded_at >= TIMESTAMP('2022-11-24T12:30:41.323Z')
)
)
)
UNION
ALL (
SELECT
user_id,
`column_a`,
`column_b`
FROM
`rudderstack`.`identifies`
WHERE
_PARTITIONTIME = TIMESTAMP('2022-11-24')
AND user_id IS NOT NULL
AND loaded_at >= TIMESTAMP('2022-11-24T12:30:41.323Z')
)
)
)gentle-petabyte-80785
11/27/2022, 8:58 AMfuture-toothbrush-54596
11/27/2022, 10:11 PMsilly-kitchen-30880
12/29/2022, 10:54 PMfuture-toothbrush-54596
01/08/2023, 10:36 PMrudderstack.users_view doesn't utilise the partitions on the rudderstack.users table it is doing a full table scan of rudderstack.users (50GB) every execution. So whilst only today's data gets returned we still get billed for the full table scan by GCP.
I imagine this would be the case for anyone using open source with BigQuery and the problem only compounds over time - is it worth raising as a GitHub issue somewhere to get fixed?