Skip to content

Add DB structure for code suggestions

What does this MR do and why?

This MR adds DB tables for storing code suggestion usage data in ClickHouse.

We store all events in CH and then create a downstream materialized view to store daily usage (used at least once for the given date). Data generation and example query:

-- generate some data
insert into code_suggestion_usages (user_id, used_at)
SELECT number % 1000 as user_id, toDateTime('2024-03-25 12:00:00', 'UTC') - (((30 + randPoisson(2000)) * 60) * 60) as used_at from numbers(100000000)

-- user used code suggestion at least once on the returned date
select user_id, used_at
from code_suggestion_daily_usages
where user_id in (0, 25, 40, 50, 60, 70, 80, 500, 600, 700, 800, 900, 950) and
used_at > '2024-01-01' and used_at < '2024-01-30' group by user_id, used_at order by user_id, used_at

The follow-up MR will contain the data ingestion implementation.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #441485 (closed)

Edited by Adam Hegyi

Merge request reports