xtrntr
09/27/2021, 9:28 AM# old (<1s)
SELECT user, count(*) FROM events
WHERE time BETWEEN 0 AND 31 AND location BETWEEN 1000 AND 1005
GROUP BY user HAVING count(*) > 10
# new (>10s)
SELECT user, count(*) FROM events
WHERE time BETWEEN 0 AND 31 AND location BETWEEN 1000 AND 1005 AND lookUp(...)=0
GROUP BY user HAVING count(*) > 10xtrntr
09/27/2021, 9:36 AMxtrntr
09/27/2021, 9:41 AMxtrntr
09/27/2021, 9:41 AMxtrntr
09/27/2021, 9:41 AMRichard Startin
09/27/2021, 9:42 AMxtrntr
09/27/2021, 9:42 AMRichard Startin
09/27/2021, 9:43 AMxtrntr
09/27/2021, 9:44 AMxtrntr
09/27/2021, 9:44 AMRichard Startin
09/27/2021, 9:46 AMim curious what are the use cases of the lookup tableit's not always possible to denormalise, e.g. if the stream filling the lookup table can lag behind the stream populating the fact table. It may be the case that the reference data updates more frequently than the facts (e.g. fx rates vs transactions) and so on. If the lookup table is static, I would just denormalise and have fast queries.
Richard Startin
09/27/2021, 9:48 AMRichard Startin
09/27/2021, 9:57 AMxtrntr
09/27/2021, 10:18 AMJackie
09/27/2021, 6:48 PMSELECT user, count(*) FROM events
WHERE time BETWEEN 0 AND 31 AND location BETWEEN 1000 AND 1005 AND lookUp(...)=0
GROUP BY userJackie
09/27/2021, 6:52 PMlookUp within the filter is quite expensive because Pinot won't be able to utilize index to solve the query, but have to scan and lookup each value. The latency of this query with or without HAVING should be similarJackie
09/27/2021, 6:54 PMORDER BY count(*) DESC to get the accurate result. Pinot won't keep all the groups by default in order to reduce the memory usage