mirror of
https://github.com/plausible/analytics.git
synced 2024-11-28 21:47:25 +03:00
d620432227
* Fix interpolation in data_migration.ex * Speed up calculating acquisition_channel in clickhouse The previous `has` queries proved to be problematic and causing a lot of CPU overhead. Benchmarked via this query: ```sql SELECT channel, count(), countIf(acquisition_channel(referrer_source, utm_medium, utm_campaign, utm_source, click_id_param) = channel) AS matches FROM events_v2 WHERE timestamp > now() - toIntervalHour(48) GROUP BY channel ORDER BY count() desc ``` Before this fix: ``` query_duration_ms: 57960 DiskReadElapsedMs: 374.712 RealTimeMs: 2891200.667 UserTimeMs: 2704024.783 SystemTimeMs: 1693.265 OSCPUWaitMs: 90.253 OSCPUVirtualTimeMs: 2705709.58 ``` After this fix: ``` query_duration_ms: 4367 DiskReadElapsedMs: 454.356 RealTimeMs: 213892.207 UserTimeMs: 199363.485 SystemTimeMs: 1479.364 OSCPUWaitMs: 13.739 OSCPUVirtualTimeMs: 200837.37 ``` Note that the new tables are not tracked in our schema as usual as they're pretty much temporary tables to create the dictionary without needing to upload files to clickhouse servers. * CREATE OR REPLACE table with SELECT |
||
---|---|---|
.. | ||
cancel_subscription.ex | ||
clean_clickhouse.ex | ||
create_free_subscription.ex | ||
download_country_database.ex | ||
generate_referrer_favicons.ex | ||
pull_sandbox_subscription.ex | ||
send_pageview.ex |