[{"data":1,"prerenderedAt":3146},["ShallowReactive",2],{"article-alternates":3,"article-\u002Ffr\u002Fdata\u002Fcohort-table-architecture-production-scaling":13},{"i18nKey":4,"paths":5},"data-007-2026-06",{"de":6,"en":7,"es":8,"fr":9,"it":10,"ru":11,"tr":12},"\u002Fde\u002Fdata\u002Fcohort-table-architecture-production-scaling","\u002Fen\u002Fdata\u002Fcohort-table-architecture-scaling-retention-analysis-production","\u002Fes\u002Fdata\u002Farquitectura-tabla-cohort","\u002Ffr\u002Fdata\u002Fcohort-table-architecture-production-scaling","\u002Fit\u002Fdata\u002Farchitettura-tabella-cohort","\u002Fru\u002Fdata\u002Fcohort-tablitsa-arkhitektura-masshtabirovanie-analiza-uderzhaniia-v-produkcii","\u002Ftr\u002Fdata\u002Fcohort-tablo-mimarisi-retention-analizinin-productionda-olceklenmesi",{"_path":9,"_dir":14,"_draft":15,"_partial":15,"_locale":16,"title":17,"description":18,"publishedAt":19,"modifiedAt":19,"category":20,"i18nKey":4,"tags":21,"readingTime":27,"author":28,"body":29,"_type":3140,"_id":3141,"_source":3142,"_file":3143,"_stem":3144,"_extension":3145},"data",false,"","Architecture des Tables de Cohortes : Mise à l'Échelle de l'Analyse de Rétention en Production","Architecture avec materialized views, partitioning et query cost optimization pour requêtes de cohortes sur 100M+ events en 5 secondes.","2026-06-09","verianalizi",[22,23,24,25,26],"cohort-analysis","bigquery","materialized-views","query-optimization","retention-engineering",9,"Roibase",{"type":30,"children":31,"toc":3131},"root",[32,40,47,83,452,471,478,491,1283,1288,1294,1306,1695,1700,1708,1834,1852,1858,1863,1881,1978,2003,2016,2040,2046,2084,2662,2667,2673,2686,3002,3015,3023,3120,3125],{"type":33,"tag":34,"props":35,"children":36},"element","p",{},[37],{"type":38,"value":39},"text","Quand vous migrez les métriques de rétention vers un dashboard temps réel, le premier choc arrive sur le coût des requêtes. Une requête de cohorte basique — « combien d'utilisateurs enregistrés le 1er janvier sont actifs au jour 7 ? » — écrite naïvement scan 200GB de données, s'exécute en 18 secondes et coûte 4 dollars. Pour une équipe avec 500 consultations de dashboard par jour, ce calcul atteint 60 000 dollars par mois. Le problème ne vient pas de votre capacité analytique, mais de l'architecture de vos tables. Pour amener l'analyse de cohorte en production, vous devez stocker des snapshots de cohortes, non les données brutes d'événements.",{"type":33,"tag":41,"props":42,"children":44},"h2",{"id":43},"requête-de-cohorte-naïve-pourquoi-cela-névolue-pas",[45],{"type":38,"value":46},"Requête de Cohorte Naïve : Pourquoi Cela N'Évolue Pas",{"type":33,"tag":34,"props":48,"children":49},{},[50,52,59,61,67,68,74,76,81],{"type":38,"value":51},"Une requête de cohorte classique joint trois tables : ",{"type":33,"tag":53,"props":54,"children":56},"code",{"className":55},[],[57],{"type":38,"value":58},"users",{"type":38,"value":60},", ",{"type":33,"tag":53,"props":62,"children":64},{"className":63},[],[65],{"type":38,"value":66},"events",{"type":38,"value":60},{"type":33,"tag":53,"props":69,"children":71},{"className":70},[],[72],{"type":38,"value":73},"cohort_definitions",{"type":38,"value":75},". À chaque exécution, la table ",{"type":33,"tag":53,"props":77,"children":79},{"className":78},[],[80],{"type":38,"value":66},{"type":38,"value":82}," est scannée sans filtre de partition. Avec 100M d'événements quotidiens, cette approche devient intenable.",{"type":33,"tag":84,"props":85,"children":89},"pre",{"className":86,"code":87,"language":88,"meta":16,"style":16},"language-sql shiki shiki-themes github-dark","-- ❌ Anti-pattern : Scanner tous les events à chaque fois\nSELECT \n  DATE_TRUNC(u.created_at, DAY) AS cohort_date,\n  DATE_DIFF(e.event_date, u.created_at, DAY) AS day_n,\n  COUNT(DISTINCT u.user_id) AS retained_users\nFROM users u\nJOIN events e ON u.user_id = e.user_id\nWHERE u.created_at >= '2026-01-01'\n  AND e.event_name = 'session_start'\nGROUP BY 1, 2\nORDER BY 1, 2;\n","sql",[90],{"type":33,"tag":53,"props":91,"children":92},{"__ignoreMap":16},[93,105,121,170,230,276,290,340,372,402,425],{"type":33,"tag":94,"props":95,"children":98},"span",{"class":96,"line":97},"line",1,[99],{"type":33,"tag":94,"props":100,"children":102},{"style":101},"--shiki-default:#6A737D",[103],{"type":38,"value":104},"-- ❌ Anti-pattern : Scanner tous les events à chaque fois\n",{"type":33,"tag":94,"props":106,"children":108},{"class":96,"line":107},2,[109,115],{"type":33,"tag":94,"props":110,"children":112},{"style":111},"--shiki-default:#F97583",[113],{"type":38,"value":114},"SELECT",{"type":33,"tag":94,"props":116,"children":118},{"style":117},"--shiki-default:#E1E4E8",[119],{"type":38,"value":120}," \n",{"type":33,"tag":94,"props":122,"children":124},{"class":96,"line":123},3,[125,130,136,141,146,150,155,160,165],{"type":33,"tag":94,"props":126,"children":127},{"style":117},[128],{"type":38,"value":129},"  DATE_TRUNC(",{"type":33,"tag":94,"props":131,"children":133},{"style":132},"--shiki-default:#79B8FF",[134],{"type":38,"value":135},"u",{"type":33,"tag":94,"props":137,"children":138},{"style":117},[139],{"type":38,"value":140},".",{"type":33,"tag":94,"props":142,"children":143},{"style":132},[144],{"type":38,"value":145},"created_at",{"type":33,"tag":94,"props":147,"children":148},{"style":117},[149],{"type":38,"value":60},{"type":33,"tag":94,"props":151,"children":152},{"style":111},[153],{"type":38,"value":154},"DAY",{"type":33,"tag":94,"props":156,"children":157},{"style":117},[158],{"type":38,"value":159},") ",{"type":33,"tag":94,"props":161,"children":162},{"style":111},[163],{"type":38,"value":164},"AS",{"type":33,"tag":94,"props":166,"children":167},{"style":117},[168],{"type":38,"value":169}," cohort_date,\n",{"type":33,"tag":94,"props":171,"children":173},{"class":96,"line":172},4,[174,179,184,188,193,197,201,205,209,213,217,221,225],{"type":33,"tag":94,"props":175,"children":176},{"style":117},[177],{"type":38,"value":178},"  DATE_DIFF(",{"type":33,"tag":94,"props":180,"children":181},{"style":132},[182],{"type":38,"value":183},"e",{"type":33,"tag":94,"props":185,"children":186},{"style":117},[187],{"type":38,"value":140},{"type":33,"tag":94,"props":189,"children":190},{"style":132},[191],{"type":38,"value":192},"event_date",{"type":33,"tag":94,"props":194,"children":195},{"style":117},[196],{"type":38,"value":60},{"type":33,"tag":94,"props":198,"children":199},{"style":132},[200],{"type":38,"value":135},{"type":33,"tag":94,"props":202,"children":203},{"style":117},[204],{"type":38,"value":140},{"type":33,"tag":94,"props":206,"children":207},{"style":132},[208],{"type":38,"value":145},{"type":33,"tag":94,"props":210,"children":211},{"style":117},[212],{"type":38,"value":60},{"type":33,"tag":94,"props":214,"children":215},{"style":111},[216],{"type":38,"value":154},{"type":33,"tag":94,"props":218,"children":219},{"style":117},[220],{"type":38,"value":159},{"type":33,"tag":94,"props":222,"children":223},{"style":111},[224],{"type":38,"value":164},{"type":33,"tag":94,"props":226,"children":227},{"style":117},[228],{"type":38,"value":229}," day_n,\n",{"type":33,"tag":94,"props":231,"children":233},{"class":96,"line":232},5,[234,239,244,249,254,258,263,267,271],{"type":33,"tag":94,"props":235,"children":236},{"style":132},[237],{"type":38,"value":238},"  COUNT",{"type":33,"tag":94,"props":240,"children":241},{"style":117},[242],{"type":38,"value":243},"(",{"type":33,"tag":94,"props":245,"children":246},{"style":111},[247],{"type":38,"value":248},"DISTINCT",{"type":33,"tag":94,"props":250,"children":251},{"style":132},[252],{"type":38,"value":253}," u",{"type":33,"tag":94,"props":255,"children":256},{"style":117},[257],{"type":38,"value":140},{"type":33,"tag":94,"props":259,"children":260},{"style":132},[261],{"type":38,"value":262},"user_id",{"type":33,"tag":94,"props":264,"children":265},{"style":117},[266],{"type":38,"value":159},{"type":33,"tag":94,"props":268,"children":269},{"style":111},[270],{"type":38,"value":164},{"type":33,"tag":94,"props":272,"children":273},{"style":117},[274],{"type":38,"value":275}," retained_users\n",{"type":33,"tag":94,"props":277,"children":279},{"class":96,"line":278},6,[280,285],{"type":33,"tag":94,"props":281,"children":282},{"style":111},[283],{"type":38,"value":284},"FROM",{"type":33,"tag":94,"props":286,"children":287},{"style":117},[288],{"type":38,"value":289}," users u\n",{"type":33,"tag":94,"props":291,"children":293},{"class":96,"line":292},7,[294,299,304,309,313,317,321,326,331,335],{"type":33,"tag":94,"props":295,"children":296},{"style":111},[297],{"type":38,"value":298},"JOIN",{"type":33,"tag":94,"props":300,"children":301},{"style":117},[302],{"type":38,"value":303}," events e ",{"type":33,"tag":94,"props":305,"children":306},{"style":111},[307],{"type":38,"value":308},"ON",{"type":33,"tag":94,"props":310,"children":311},{"style":132},[312],{"type":38,"value":253},{"type":33,"tag":94,"props":314,"children":315},{"style":117},[316],{"type":38,"value":140},{"type":33,"tag":94,"props":318,"children":319},{"style":132},[320],{"type":38,"value":262},{"type":33,"tag":94,"props":322,"children":323},{"style":111},[324],{"type":38,"value":325}," =",{"type":33,"tag":94,"props":327,"children":328},{"style":132},[329],{"type":38,"value":330}," e",{"type":33,"tag":94,"props":332,"children":333},{"style":117},[334],{"type":38,"value":140},{"type":33,"tag":94,"props":336,"children":337},{"style":132},[338],{"type":38,"value":339},"user_id\n",{"type":33,"tag":94,"props":341,"children":343},{"class":96,"line":342},8,[344,349,353,357,361,366],{"type":33,"tag":94,"props":345,"children":346},{"style":111},[347],{"type":38,"value":348},"WHERE",{"type":33,"tag":94,"props":350,"children":351},{"style":132},[352],{"type":38,"value":253},{"type":33,"tag":94,"props":354,"children":355},{"style":117},[356],{"type":38,"value":140},{"type":33,"tag":94,"props":358,"children":359},{"style":132},[360],{"type":38,"value":145},{"type":33,"tag":94,"props":362,"children":363},{"style":111},[364],{"type":38,"value":365}," >=",{"type":33,"tag":94,"props":367,"children":369},{"style":368},"--shiki-default:#9ECBFF",[370],{"type":38,"value":371}," '2026-01-01'\n",{"type":33,"tag":94,"props":373,"children":374},{"class":96,"line":27},[375,380,384,388,393,397],{"type":33,"tag":94,"props":376,"children":377},{"style":111},[378],{"type":38,"value":379},"  AND",{"type":33,"tag":94,"props":381,"children":382},{"style":132},[383],{"type":38,"value":330},{"type":33,"tag":94,"props":385,"children":386},{"style":117},[387],{"type":38,"value":140},{"type":33,"tag":94,"props":389,"children":390},{"style":132},[391],{"type":38,"value":392},"event_name",{"type":33,"tag":94,"props":394,"children":395},{"style":111},[396],{"type":38,"value":325},{"type":33,"tag":94,"props":398,"children":399},{"style":368},[400],{"type":38,"value":401}," 'session_start'\n",{"type":33,"tag":94,"props":403,"children":405},{"class":96,"line":404},10,[406,411,416,420],{"type":33,"tag":94,"props":407,"children":408},{"style":111},[409],{"type":38,"value":410},"GROUP BY",{"type":33,"tag":94,"props":412,"children":413},{"style":132},[414],{"type":38,"value":415}," 1",{"type":33,"tag":94,"props":417,"children":418},{"style":117},[419],{"type":38,"value":60},{"type":33,"tag":94,"props":421,"children":422},{"style":132},[423],{"type":38,"value":424},"2\n",{"type":33,"tag":94,"props":426,"children":428},{"class":96,"line":427},11,[429,434,438,442,447],{"type":33,"tag":94,"props":430,"children":431},{"style":111},[432],{"type":38,"value":433},"ORDER BY",{"type":33,"tag":94,"props":435,"children":436},{"style":132},[437],{"type":38,"value":415},{"type":33,"tag":94,"props":439,"children":440},{"style":117},[441],{"type":38,"value":60},{"type":33,"tag":94,"props":443,"children":444},{"style":132},[445],{"type":38,"value":446},"2",{"type":33,"tag":94,"props":448,"children":449},{"style":117},[450],{"type":38,"value":451},";\n",{"type":33,"tag":34,"props":453,"children":454},{},[455,457,463,465,470],{"type":38,"value":456},"Cette requête scan 480GB pour 6 mois de données. Sur BigQuery, l'utilisation des slots prend 12 secondes et coûte 2,40 dollars (tarification à la demande : 5$\u002FTB). Si vous multipliez la même cohorte par 20 métriques différentes (revenu, nombre de sessions, taux de conversion), le coût monte à 48 dollars. Si le dashboard se rafraîchit 100 fois par jour, le coût mensuel atteint 144 000 dollars. Pour adapter le problème à la production, deux stratégies existent : ",{"type":33,"tag":458,"props":459,"children":460},"strong",{},[461],{"type":38,"value":462},"materialization incrémentale",{"type":38,"value":464}," et ",{"type":33,"tag":458,"props":466,"children":467},{},[468],{"type":38,"value":469},"snapshots de cohortes pré-agrégés",{"type":38,"value":140},{"type":33,"tag":472,"props":473,"children":475},"h3",{"id":474},"materialization-incrémentale-pipeline-event-to-cohorte-avec-dbt",[476],{"type":38,"value":477},"Materialization Incrémentale : Pipeline Event-to-Cohorte avec dbt",{"type":33,"tag":34,"props":479,"children":480},{},[481,483,489],{"type":38,"value":482},"Au lieu de recalculer les cohortes à chaque fois, mettez à jour quotidiennement une table cumulée via des batches. La stratégie ",{"type":33,"tag":53,"props":484,"children":486},{"className":485},[],[487],{"type":38,"value":488},"incremental",{"type":38,"value":490}," de dbt vous permet d'ajouter les événements du nouveau jour à votre table de cohorte existante.",{"type":33,"tag":84,"props":492,"children":494},{"className":86,"code":493,"language":88,"meta":16,"style":16},"-- models\u002Fcohort_retention_daily.sql\n{{\n  config(\n    materialized='incremental',\n    partition_by={'field': 'cohort_date', 'data_type': 'date'},\n    cluster_by=['day_n', 'metric_name'],\n    unique_key='cohort_date || day_n || metric_name'\n  )\n}}\n\nWITH new_events AS (\n  SELECT \n    u.user_id,\n    DATE_TRUNC(u.created_at, DAY) AS cohort_date,\n    DATE_DIFF(e.event_date, u.created_at, DAY) AS day_n,\n    e.event_name,\n    e.revenue_usd\n  FROM {{ ref('events') }} e\n  JOIN {{ ref('users') }} u ON e.user_id = u.user_id\n  {% if is_incremental() %}\n  WHERE e.event_date = CURRENT_DATE() - 1  -- Uniquement les données d'hier\n  {% endif %}\n)\nSELECT\n  cohort_date,\n  day_n,\n  'active_users' AS metric_name,\n  COUNT(DISTINCT user_id) AS metric_value\nFROM new_events\nWHERE event_name = 'session_start'\nGROUP BY 1, 2, 3\n\nUNION ALL\n\nSELECT\n  cohort_date,\n  day_n,\n  'revenue_per_cohort' AS metric_name,\n  SUM(revenue_usd) AS metric_value\nFROM new_events\nGROUP BY 1, 2, 3;\n",[495],{"type":33,"tag":53,"props":496,"children":497},{"__ignoreMap":16},[498,506,514,522,545,600,617,634,642,650,659,681,694,715,756,813,834,851,875,930,949,993,1002,1011,1020,1029,1038,1057,1087,1100,1121,1150,1158,1167,1175,1183,1191,1199,1216,1238,1250],{"type":33,"tag":94,"props":499,"children":500},{"class":96,"line":97},[501],{"type":33,"tag":94,"props":502,"children":503},{"style":101},[504],{"type":38,"value":505},"-- models\u002Fcohort_retention_daily.sql\n",{"type":33,"tag":94,"props":507,"children":508},{"class":96,"line":107},[509],{"type":33,"tag":94,"props":510,"children":511},{"style":117},[512],{"type":38,"value":513},"{{\n",{"type":33,"tag":94,"props":515,"children":516},{"class":96,"line":123},[517],{"type":33,"tag":94,"props":518,"children":519},{"style":117},[520],{"type":38,"value":521},"  config(\n",{"type":33,"tag":94,"props":523,"children":524},{"class":96,"line":172},[525,530,535,540],{"type":33,"tag":94,"props":526,"children":527},{"style":117},[528],{"type":38,"value":529},"    materialized",{"type":33,"tag":94,"props":531,"children":532},{"style":111},[533],{"type":38,"value":534},"=",{"type":33,"tag":94,"props":536,"children":537},{"style":368},[538],{"type":38,"value":539},"'incremental'",{"type":33,"tag":94,"props":541,"children":542},{"style":117},[543],{"type":38,"value":544},",\n",{"type":33,"tag":94,"props":546,"children":547},{"class":96,"line":232},[548,553,557,562,567,572,577,581,586,590,595],{"type":33,"tag":94,"props":549,"children":550},{"style":117},[551],{"type":38,"value":552},"    partition_by",{"type":33,"tag":94,"props":554,"children":555},{"style":111},[556],{"type":38,"value":534},{"type":33,"tag":94,"props":558,"children":559},{"style":117},[560],{"type":38,"value":561},"{",{"type":33,"tag":94,"props":563,"children":564},{"style":368},[565],{"type":38,"value":566},"'field'",{"type":33,"tag":94,"props":568,"children":569},{"style":117},[570],{"type":38,"value":571},": ",{"type":33,"tag":94,"props":573,"children":574},{"style":368},[575],{"type":38,"value":576},"'cohort_date'",{"type":33,"tag":94,"props":578,"children":579},{"style":117},[580],{"type":38,"value":60},{"type":33,"tag":94,"props":582,"children":583},{"style":368},[584],{"type":38,"value":585},"'data_type'",{"type":33,"tag":94,"props":587,"children":588},{"style":117},[589],{"type":38,"value":571},{"type":33,"tag":94,"props":591,"children":592},{"style":368},[593],{"type":38,"value":594},"'date'",{"type":33,"tag":94,"props":596,"children":597},{"style":117},[598],{"type":38,"value":599},"},\n",{"type":33,"tag":94,"props":601,"children":602},{"class":96,"line":278},[603,608,612],{"type":33,"tag":94,"props":604,"children":605},{"style":117},[606],{"type":38,"value":607},"    cluster_by",{"type":33,"tag":94,"props":609,"children":610},{"style":111},[611],{"type":38,"value":534},{"type":33,"tag":94,"props":613,"children":614},{"style":117},[615],{"type":38,"value":616},"['day_n', 'metric_name'],\n",{"type":33,"tag":94,"props":618,"children":619},{"class":96,"line":292},[620,625,629],{"type":33,"tag":94,"props":621,"children":622},{"style":117},[623],{"type":38,"value":624},"    unique_key",{"type":33,"tag":94,"props":626,"children":627},{"style":111},[628],{"type":38,"value":534},{"type":33,"tag":94,"props":630,"children":631},{"style":368},[632],{"type":38,"value":633},"'cohort_date || day_n || metric_name'\n",{"type":33,"tag":94,"props":635,"children":636},{"class":96,"line":342},[637],{"type":33,"tag":94,"props":638,"children":639},{"style":117},[640],{"type":38,"value":641},"  )\n",{"type":33,"tag":94,"props":643,"children":644},{"class":96,"line":27},[645],{"type":33,"tag":94,"props":646,"children":647},{"style":117},[648],{"type":38,"value":649},"}}\n",{"type":33,"tag":94,"props":651,"children":652},{"class":96,"line":404},[653],{"type":33,"tag":94,"props":654,"children":656},{"emptyLinePlaceholder":655},true,[657],{"type":38,"value":658},"\n",{"type":33,"tag":94,"props":660,"children":661},{"class":96,"line":427},[662,667,672,676],{"type":33,"tag":94,"props":663,"children":664},{"style":111},[665],{"type":38,"value":666},"WITH",{"type":33,"tag":94,"props":668,"children":669},{"style":117},[670],{"type":38,"value":671}," new_events ",{"type":33,"tag":94,"props":673,"children":674},{"style":111},[675],{"type":38,"value":164},{"type":33,"tag":94,"props":677,"children":678},{"style":117},[679],{"type":38,"value":680}," (\n",{"type":33,"tag":94,"props":682,"children":684},{"class":96,"line":683},12,[685,690],{"type":33,"tag":94,"props":686,"children":687},{"style":111},[688],{"type":38,"value":689},"  SELECT",{"type":33,"tag":94,"props":691,"children":692},{"style":117},[693],{"type":38,"value":120},{"type":33,"tag":94,"props":695,"children":697},{"class":96,"line":696},13,[698,703,707,711],{"type":33,"tag":94,"props":699,"children":700},{"style":132},[701],{"type":38,"value":702},"    u",{"type":33,"tag":94,"props":704,"children":705},{"style":117},[706],{"type":38,"value":140},{"type":33,"tag":94,"props":708,"children":709},{"style":132},[710],{"type":38,"value":262},{"type":33,"tag":94,"props":712,"children":713},{"style":117},[714],{"type":38,"value":544},{"type":33,"tag":94,"props":716,"children":718},{"class":96,"line":717},14,[719,724,728,732,736,740,744,748,752],{"type":33,"tag":94,"props":720,"children":721},{"style":117},[722],{"type":38,"value":723},"    DATE_TRUNC(",{"type":33,"tag":94,"props":725,"children":726},{"style":132},[727],{"type":38,"value":135},{"type":33,"tag":94,"props":729,"children":730},{"style":117},[731],{"type":38,"value":140},{"type":33,"tag":94,"props":733,"children":734},{"style":132},[735],{"type":38,"value":145},{"type":33,"tag":94,"props":737,"children":738},{"style":117},[739],{"type":38,"value":60},{"type":33,"tag":94,"props":741,"children":742},{"style":111},[743],{"type":38,"value":154},{"type":33,"tag":94,"props":745,"children":746},{"style":117},[747],{"type":38,"value":159},{"type":33,"tag":94,"props":749,"children":750},{"style":111},[751],{"type":38,"value":164},{"type":33,"tag":94,"props":753,"children":754},{"style":117},[755],{"type":38,"value":169},{"type":33,"tag":94,"props":757,"children":759},{"class":96,"line":758},15,[760,765,769,773,777,781,785,789,793,797,801,805,809],{"type":33,"tag":94,"props":761,"children":762},{"style":117},[763],{"type":38,"value":764},"    DATE_DIFF(",{"type":33,"tag":94,"props":766,"children":767},{"style":132},[768],{"type":38,"value":183},{"type":33,"tag":94,"props":770,"children":771},{"style":117},[772],{"type":38,"value":140},{"type":33,"tag":94,"props":774,"children":775},{"style":132},[776],{"type":38,"value":192},{"type":33,"tag":94,"props":778,"children":779},{"style":117},[780],{"type":38,"value":60},{"type":33,"tag":94,"props":782,"children":783},{"style":132},[784],{"type":38,"value":135},{"type":33,"tag":94,"props":786,"children":787},{"style":117},[788],{"type":38,"value":140},{"type":33,"tag":94,"props":790,"children":791},{"style":132},[792],{"type":38,"value":145},{"type":33,"tag":94,"props":794,"children":795},{"style":117},[796],{"type":38,"value":60},{"type":33,"tag":94,"props":798,"children":799},{"style":111},[800],{"type":38,"value":154},{"type":33,"tag":94,"props":802,"children":803},{"style":117},[804],{"type":38,"value":159},{"type":33,"tag":94,"props":806,"children":807},{"style":111},[808],{"type":38,"value":164},{"type":33,"tag":94,"props":810,"children":811},{"style":117},[812],{"type":38,"value":229},{"type":33,"tag":94,"props":814,"children":816},{"class":96,"line":815},16,[817,822,826,830],{"type":33,"tag":94,"props":818,"children":819},{"style":132},[820],{"type":38,"value":821},"    e",{"type":33,"tag":94,"props":823,"children":824},{"style":117},[825],{"type":38,"value":140},{"type":33,"tag":94,"props":827,"children":828},{"style":132},[829],{"type":38,"value":392},{"type":33,"tag":94,"props":831,"children":832},{"style":117},[833],{"type":38,"value":544},{"type":33,"tag":94,"props":835,"children":837},{"class":96,"line":836},17,[838,842,846],{"type":33,"tag":94,"props":839,"children":840},{"style":132},[841],{"type":38,"value":821},{"type":33,"tag":94,"props":843,"children":844},{"style":117},[845],{"type":38,"value":140},{"type":33,"tag":94,"props":847,"children":848},{"style":132},[849],{"type":38,"value":850},"revenue_usd\n",{"type":33,"tag":94,"props":852,"children":854},{"class":96,"line":853},18,[855,860,865,870],{"type":33,"tag":94,"props":856,"children":857},{"style":111},[858],{"type":38,"value":859},"  FROM",{"type":33,"tag":94,"props":861,"children":862},{"style":117},[863],{"type":38,"value":864}," {{ ref(",{"type":33,"tag":94,"props":866,"children":867},{"style":368},[868],{"type":38,"value":869},"'events'",{"type":33,"tag":94,"props":871,"children":872},{"style":117},[873],{"type":38,"value":874},") }} e\n",{"type":33,"tag":94,"props":876,"children":878},{"class":96,"line":877},19,[879,884,888,893,898,902,906,910,914,918,922,926],{"type":33,"tag":94,"props":880,"children":881},{"style":111},[882],{"type":38,"value":883},"  JOIN",{"type":33,"tag":94,"props":885,"children":886},{"style":117},[887],{"type":38,"value":864},{"type":33,"tag":94,"props":889,"children":890},{"style":368},[891],{"type":38,"value":892},"'users'",{"type":33,"tag":94,"props":894,"children":895},{"style":117},[896],{"type":38,"value":897},") }} u ",{"type":33,"tag":94,"props":899,"children":900},{"style":111},[901],{"type":38,"value":308},{"type":33,"tag":94,"props":903,"children":904},{"style":132},[905],{"type":38,"value":330},{"type":33,"tag":94,"props":907,"children":908},{"style":117},[909],{"type":38,"value":140},{"type":33,"tag":94,"props":911,"children":912},{"style":132},[913],{"type":38,"value":262},{"type":33,"tag":94,"props":915,"children":916},{"style":111},[917],{"type":38,"value":325},{"type":33,"tag":94,"props":919,"children":920},{"style":132},[921],{"type":38,"value":253},{"type":33,"tag":94,"props":923,"children":924},{"style":117},[925],{"type":38,"value":140},{"type":33,"tag":94,"props":927,"children":928},{"style":132},[929],{"type":38,"value":339},{"type":33,"tag":94,"props":931,"children":933},{"class":96,"line":932},20,[934,939,944],{"type":33,"tag":94,"props":935,"children":936},{"style":117},[937],{"type":38,"value":938},"  {% ",{"type":33,"tag":94,"props":940,"children":941},{"style":111},[942],{"type":38,"value":943},"if",{"type":33,"tag":94,"props":945,"children":946},{"style":117},[947],{"type":38,"value":948}," is_incremental() %}\n",{"type":33,"tag":94,"props":950,"children":952},{"class":96,"line":951},21,[953,958,962,966,970,974,979,984,988],{"type":33,"tag":94,"props":954,"children":955},{"style":111},[956],{"type":38,"value":957},"  WHERE",{"type":33,"tag":94,"props":959,"children":960},{"style":132},[961],{"type":38,"value":330},{"type":33,"tag":94,"props":963,"children":964},{"style":117},[965],{"type":38,"value":140},{"type":33,"tag":94,"props":967,"children":968},{"style":132},[969],{"type":38,"value":192},{"type":33,"tag":94,"props":971,"children":972},{"style":111},[973],{"type":38,"value":325},{"type":33,"tag":94,"props":975,"children":976},{"style":117},[977],{"type":38,"value":978}," CURRENT_DATE() ",{"type":33,"tag":94,"props":980,"children":981},{"style":111},[982],{"type":38,"value":983},"-",{"type":33,"tag":94,"props":985,"children":986},{"style":132},[987],{"type":38,"value":415},{"type":33,"tag":94,"props":989,"children":990},{"style":101},[991],{"type":38,"value":992},"  -- Uniquement les données d'hier\n",{"type":33,"tag":94,"props":994,"children":996},{"class":96,"line":995},22,[997],{"type":33,"tag":94,"props":998,"children":999},{"style":117},[1000],{"type":38,"value":1001},"  {% endif %}\n",{"type":33,"tag":94,"props":1003,"children":1005},{"class":96,"line":1004},23,[1006],{"type":33,"tag":94,"props":1007,"children":1008},{"style":117},[1009],{"type":38,"value":1010},")\n",{"type":33,"tag":94,"props":1012,"children":1014},{"class":96,"line":1013},24,[1015],{"type":33,"tag":94,"props":1016,"children":1017},{"style":111},[1018],{"type":38,"value":1019},"SELECT\n",{"type":33,"tag":94,"props":1021,"children":1023},{"class":96,"line":1022},25,[1024],{"type":33,"tag":94,"props":1025,"children":1026},{"style":117},[1027],{"type":38,"value":1028},"  cohort_date,\n",{"type":33,"tag":94,"props":1030,"children":1032},{"class":96,"line":1031},26,[1033],{"type":33,"tag":94,"props":1034,"children":1035},{"style":117},[1036],{"type":38,"value":1037},"  day_n,\n",{"type":33,"tag":94,"props":1039,"children":1041},{"class":96,"line":1040},27,[1042,1047,1052],{"type":33,"tag":94,"props":1043,"children":1044},{"style":368},[1045],{"type":38,"value":1046},"  'active_users'",{"type":33,"tag":94,"props":1048,"children":1049},{"style":111},[1050],{"type":38,"value":1051}," AS",{"type":33,"tag":94,"props":1053,"children":1054},{"style":117},[1055],{"type":38,"value":1056}," metric_name,\n",{"type":33,"tag":94,"props":1058,"children":1060},{"class":96,"line":1059},28,[1061,1065,1069,1073,1078,1082],{"type":33,"tag":94,"props":1062,"children":1063},{"style":132},[1064],{"type":38,"value":238},{"type":33,"tag":94,"props":1066,"children":1067},{"style":117},[1068],{"type":38,"value":243},{"type":33,"tag":94,"props":1070,"children":1071},{"style":111},[1072],{"type":38,"value":248},{"type":33,"tag":94,"props":1074,"children":1075},{"style":117},[1076],{"type":38,"value":1077}," user_id) ",{"type":33,"tag":94,"props":1079,"children":1080},{"style":111},[1081],{"type":38,"value":164},{"type":33,"tag":94,"props":1083,"children":1084},{"style":117},[1085],{"type":38,"value":1086}," metric_value\n",{"type":33,"tag":94,"props":1088,"children":1090},{"class":96,"line":1089},29,[1091,1095],{"type":33,"tag":94,"props":1092,"children":1093},{"style":111},[1094],{"type":38,"value":284},{"type":33,"tag":94,"props":1096,"children":1097},{"style":117},[1098],{"type":38,"value":1099}," new_events\n",{"type":33,"tag":94,"props":1101,"children":1103},{"class":96,"line":1102},30,[1104,1108,1113,1117],{"type":33,"tag":94,"props":1105,"children":1106},{"style":111},[1107],{"type":38,"value":348},{"type":33,"tag":94,"props":1109,"children":1110},{"style":117},[1111],{"type":38,"value":1112}," event_name ",{"type":33,"tag":94,"props":1114,"children":1115},{"style":111},[1116],{"type":38,"value":534},{"type":33,"tag":94,"props":1118,"children":1119},{"style":368},[1120],{"type":38,"value":401},{"type":33,"tag":94,"props":1122,"children":1124},{"class":96,"line":1123},31,[1125,1129,1133,1137,1141,1145],{"type":33,"tag":94,"props":1126,"children":1127},{"style":111},[1128],{"type":38,"value":410},{"type":33,"tag":94,"props":1130,"children":1131},{"style":132},[1132],{"type":38,"value":415},{"type":33,"tag":94,"props":1134,"children":1135},{"style":117},[1136],{"type":38,"value":60},{"type":33,"tag":94,"props":1138,"children":1139},{"style":132},[1140],{"type":38,"value":446},{"type":33,"tag":94,"props":1142,"children":1143},{"style":117},[1144],{"type":38,"value":60},{"type":33,"tag":94,"props":1146,"children":1147},{"style":132},[1148],{"type":38,"value":1149},"3\n",{"type":33,"tag":94,"props":1151,"children":1153},{"class":96,"line":1152},32,[1154],{"type":33,"tag":94,"props":1155,"children":1156},{"emptyLinePlaceholder":655},[1157],{"type":38,"value":658},{"type":33,"tag":94,"props":1159,"children":1161},{"class":96,"line":1160},33,[1162],{"type":33,"tag":94,"props":1163,"children":1164},{"style":111},[1165],{"type":38,"value":1166},"UNION ALL\n",{"type":33,"tag":94,"props":1168,"children":1170},{"class":96,"line":1169},34,[1171],{"type":33,"tag":94,"props":1172,"children":1173},{"emptyLinePlaceholder":655},[1174],{"type":38,"value":658},{"type":33,"tag":94,"props":1176,"children":1178},{"class":96,"line":1177},35,[1179],{"type":33,"tag":94,"props":1180,"children":1181},{"style":111},[1182],{"type":38,"value":1019},{"type":33,"tag":94,"props":1184,"children":1186},{"class":96,"line":1185},36,[1187],{"type":33,"tag":94,"props":1188,"children":1189},{"style":117},[1190],{"type":38,"value":1028},{"type":33,"tag":94,"props":1192,"children":1194},{"class":96,"line":1193},37,[1195],{"type":33,"tag":94,"props":1196,"children":1197},{"style":117},[1198],{"type":38,"value":1037},{"type":33,"tag":94,"props":1200,"children":1202},{"class":96,"line":1201},38,[1203,1208,1212],{"type":33,"tag":94,"props":1204,"children":1205},{"style":368},[1206],{"type":38,"value":1207},"  'revenue_per_cohort'",{"type":33,"tag":94,"props":1209,"children":1210},{"style":111},[1211],{"type":38,"value":1051},{"type":33,"tag":94,"props":1213,"children":1214},{"style":117},[1215],{"type":38,"value":1056},{"type":33,"tag":94,"props":1217,"children":1219},{"class":96,"line":1218},39,[1220,1225,1230,1234],{"type":33,"tag":94,"props":1221,"children":1222},{"style":132},[1223],{"type":38,"value":1224},"  SUM",{"type":33,"tag":94,"props":1226,"children":1227},{"style":117},[1228],{"type":38,"value":1229},"(revenue_usd) ",{"type":33,"tag":94,"props":1231,"children":1232},{"style":111},[1233],{"type":38,"value":164},{"type":33,"tag":94,"props":1235,"children":1236},{"style":117},[1237],{"type":38,"value":1086},{"type":33,"tag":94,"props":1239,"children":1241},{"class":96,"line":1240},40,[1242,1246],{"type":33,"tag":94,"props":1243,"children":1244},{"style":111},[1245],{"type":38,"value":284},{"type":33,"tag":94,"props":1247,"children":1248},{"style":117},[1249],{"type":38,"value":1099},{"type":33,"tag":94,"props":1251,"children":1253},{"class":96,"line":1252},41,[1254,1258,1262,1266,1270,1274,1279],{"type":33,"tag":94,"props":1255,"children":1256},{"style":111},[1257],{"type":38,"value":410},{"type":33,"tag":94,"props":1259,"children":1260},{"style":132},[1261],{"type":38,"value":415},{"type":33,"tag":94,"props":1263,"children":1264},{"style":117},[1265],{"type":38,"value":60},{"type":33,"tag":94,"props":1267,"children":1268},{"style":132},[1269],{"type":38,"value":446},{"type":33,"tag":94,"props":1271,"children":1272},{"style":117},[1273],{"type":38,"value":60},{"type":33,"tag":94,"props":1275,"children":1276},{"style":132},[1277],{"type":38,"value":1278},"3",{"type":33,"tag":94,"props":1280,"children":1281},{"style":117},[1282],{"type":38,"value":451},{"type":33,"tag":34,"props":1284,"children":1285},{},[1286],{"type":38,"value":1287},"À la première exécution (full refresh), toutes les données historiques sont traitées. Ensuite, seul 1 jour de nouveaux événements est ajouté quotidiennement. Un jour représentant 100M événements scan 3,2GB de données (grâce au partitioning et clustering), la requête prend 4 secondes, le coût est 0,016 dollar. Coût incrémental mensuel total : 0,48 dollar — un 300 000ème du coût de la méthode naïve.",{"type":33,"tag":41,"props":1289,"children":1291},{"id":1290},"materialized-views-couche-de-cache-automatique-de-bigquery",[1292],{"type":38,"value":1293},"Materialized Views : Couche de Cache Automatique de BigQuery",{"type":33,"tag":34,"props":1295,"children":1296},{},[1297,1299,1304],{"type":38,"value":1298},"Le modèle incrémental se rafraîchit par batch (une fois par jour). Si vous voulez ajouter les données de la dernière heure à un dashboard temps réel, la fonctionnalité ",{"type":33,"tag":458,"props":1300,"children":1301},{},[1302],{"type":38,"value":1303},"materialized view",{"type":38,"value":1305}," de BigQuery entre en jeu. Une materialized view stocke physiquement le résultat de la requête de base et se rafraîchit automatiquement quand les tables source changent.",{"type":33,"tag":84,"props":1307,"children":1309},{"className":86,"code":1308,"language":88,"meta":16,"style":16},"CREATE MATERIALIZED VIEW `project.dataset.cohort_retention_mv`\nPARTITION BY cohort_date\nCLUSTER BY day_n, metric_name\nAS\nSELECT\n  DATE_TRUNC(u.created_at, DAY) AS cohort_date,\n  DATE_DIFF(e.event_date, u.created_at, DAY) AS day_n,\n  'active_users' AS metric_name,\n  COUNT(DISTINCT u.user_id) AS metric_value\nFROM `project.dataset.events` e\nJOIN `project.dataset.users` u ON e.user_id = u.user_id\nWHERE e.event_date >= CURRENT_DATE() - 90  -- Fenêtre de 90 jours seulement\n  AND e.event_name = 'session_start'\nGROUP BY 1, 2, 3;\n",[1310],{"type":33,"tag":53,"props":1311,"children":1312},{"__ignoreMap":16},[1313,1331,1349,1367,1375,1382,1421,1476,1491,1530,1547,1596,1637,1664],{"type":33,"tag":94,"props":1314,"children":1315},{"class":96,"line":97},[1316,1321,1326],{"type":33,"tag":94,"props":1317,"children":1318},{"style":111},[1319],{"type":38,"value":1320},"CREATE",{"type":33,"tag":94,"props":1322,"children":1323},{"style":117},[1324],{"type":38,"value":1325}," MATERIALIZED VIEW ",{"type":33,"tag":94,"props":1327,"children":1328},{"style":368},[1329],{"type":38,"value":1330},"`project.dataset.cohort_retention_mv`\n",{"type":33,"tag":94,"props":1332,"children":1333},{"class":96,"line":107},[1334,1339,1344],{"type":33,"tag":94,"props":1335,"children":1336},{"style":111},[1337],{"type":38,"value":1338},"PARTITION",{"type":33,"tag":94,"props":1340,"children":1341},{"style":111},[1342],{"type":38,"value":1343}," BY",{"type":33,"tag":94,"props":1345,"children":1346},{"style":117},[1347],{"type":38,"value":1348}," cohort_date\n",{"type":33,"tag":94,"props":1350,"children":1351},{"class":96,"line":123},[1352,1357,1362],{"type":33,"tag":94,"props":1353,"children":1354},{"style":117},[1355],{"type":38,"value":1356},"CLUSTER ",{"type":33,"tag":94,"props":1358,"children":1359},{"style":111},[1360],{"type":38,"value":1361},"BY",{"type":33,"tag":94,"props":1363,"children":1364},{"style":117},[1365],{"type":38,"value":1366}," day_n, metric_name\n",{"type":33,"tag":94,"props":1368,"children":1369},{"class":96,"line":172},[1370],{"type":33,"tag":94,"props":1371,"children":1372},{"style":111},[1373],{"type":38,"value":1374},"AS\n",{"type":33,"tag":94,"props":1376,"children":1377},{"class":96,"line":232},[1378],{"type":33,"tag":94,"props":1379,"children":1380},{"style":111},[1381],{"type":38,"value":1019},{"type":33,"tag":94,"props":1383,"children":1384},{"class":96,"line":278},[1385,1389,1393,1397,1401,1405,1409,1413,1417],{"type":33,"tag":94,"props":1386,"children":1387},{"style":117},[1388],{"type":38,"value":129},{"type":33,"tag":94,"props":1390,"children":1391},{"style":132},[1392],{"type":38,"value":135},{"type":33,"tag":94,"props":1394,"children":1395},{"style":117},[1396],{"type":38,"value":140},{"type":33,"tag":94,"props":1398,"children":1399},{"style":132},[1400],{"type":38,"value":145},{"type":33,"tag":94,"props":1402,"children":1403},{"style":117},[1404],{"type":38,"value":60},{"type":33,"tag":94,"props":1406,"children":1407},{"style":111},[1408],{"type":38,"value":154},{"type":33,"tag":94,"props":1410,"children":1411},{"style":117},[1412],{"type":38,"value":159},{"type":33,"tag":94,"props":1414,"children":1415},{"style":111},[1416],{"type":38,"value":164},{"type":33,"tag":94,"props":1418,"children":1419},{"style":117},[1420],{"type":38,"value":169},{"type":33,"tag":94,"props":1422,"children":1423},{"class":96,"line":292},[1424,1428,1432,1436,1440,1444,1448,1452,1456,1460,1464,1468,1472],{"type":33,"tag":94,"props":1425,"children":1426},{"style":117},[1427],{"type":38,"value":178},{"type":33,"tag":94,"props":1429,"children":1430},{"style":132},[1431],{"type":38,"value":183},{"type":33,"tag":94,"props":1433,"children":1434},{"style":117},[1435],{"type":38,"value":140},{"type":33,"tag":94,"props":1437,"children":1438},{"style":132},[1439],{"type":38,"value":192},{"type":33,"tag":94,"props":1441,"children":1442},{"style":117},[1443],{"type":38,"value":60},{"type":33,"tag":94,"props":1445,"children":1446},{"style":132},[1447],{"type":38,"value":135},{"type":33,"tag":94,"props":1449,"children":1450},{"style":117},[1451],{"type":38,"value":140},{"type":33,"tag":94,"props":1453,"children":1454},{"style":132},[1455],{"type":38,"value":145},{"type":33,"tag":94,"props":1457,"children":1458},{"style":117},[1459],{"type":38,"value":60},{"type":33,"tag":94,"props":1461,"children":1462},{"style":111},[1463],{"type":38,"value":154},{"type":33,"tag":94,"props":1465,"children":1466},{"style":117},[1467],{"type":38,"value":159},{"type":33,"tag":94,"props":1469,"children":1470},{"style":111},[1471],{"type":38,"value":164},{"type":33,"tag":94,"props":1473,"children":1474},{"style":117},[1475],{"type":38,"value":229},{"type":33,"tag":94,"props":1477,"children":1478},{"class":96,"line":342},[1479,1483,1487],{"type":33,"tag":94,"props":1480,"children":1481},{"style":368},[1482],{"type":38,"value":1046},{"type":33,"tag":94,"props":1484,"children":1485},{"style":111},[1486],{"type":38,"value":1051},{"type":33,"tag":94,"props":1488,"children":1489},{"style":117},[1490],{"type":38,"value":1056},{"type":33,"tag":94,"props":1492,"children":1493},{"class":96,"line":27},[1494,1498,1502,1506,1510,1514,1518,1522,1526],{"type":33,"tag":94,"props":1495,"children":1496},{"style":132},[1497],{"type":38,"value":238},{"type":33,"tag":94,"props":1499,"children":1500},{"style":117},[1501],{"type":38,"value":243},{"type":33,"tag":94,"props":1503,"children":1504},{"style":111},[1505],{"type":38,"value":248},{"type":33,"tag":94,"props":1507,"children":1508},{"style":132},[1509],{"type":38,"value":253},{"type":33,"tag":94,"props":1511,"children":1512},{"style":117},[1513],{"type":38,"value":140},{"type":33,"tag":94,"props":1515,"children":1516},{"style":132},[1517],{"type":38,"value":262},{"type":33,"tag":94,"props":1519,"children":1520},{"style":117},[1521],{"type":38,"value":159},{"type":33,"tag":94,"props":1523,"children":1524},{"style":111},[1525],{"type":38,"value":164},{"type":33,"tag":94,"props":1527,"children":1528},{"style":117},[1529],{"type":38,"value":1086},{"type":33,"tag":94,"props":1531,"children":1532},{"class":96,"line":404},[1533,1537,1542],{"type":33,"tag":94,"props":1534,"children":1535},{"style":111},[1536],{"type":38,"value":284},{"type":33,"tag":94,"props":1538,"children":1539},{"style":368},[1540],{"type":38,"value":1541}," `project.dataset.events`",{"type":33,"tag":94,"props":1543,"children":1544},{"style":117},[1545],{"type":38,"value":1546}," e\n",{"type":33,"tag":94,"props":1548,"children":1549},{"class":96,"line":427},[1550,1554,1559,1564,1568,1572,1576,1580,1584,1588,1592],{"type":33,"tag":94,"props":1551,"children":1552},{"style":111},[1553],{"type":38,"value":298},{"type":33,"tag":94,"props":1555,"children":1556},{"style":368},[1557],{"type":38,"value":1558}," `project.dataset.users`",{"type":33,"tag":94,"props":1560,"children":1561},{"style":117},[1562],{"type":38,"value":1563}," u ",{"type":33,"tag":94,"props":1565,"children":1566},{"style":111},[1567],{"type":38,"value":308},{"type":33,"tag":94,"props":1569,"children":1570},{"style":132},[1571],{"type":38,"value":330},{"type":33,"tag":94,"props":1573,"children":1574},{"style":117},[1575],{"type":38,"value":140},{"type":33,"tag":94,"props":1577,"children":1578},{"style":132},[1579],{"type":38,"value":262},{"type":33,"tag":94,"props":1581,"children":1582},{"style":111},[1583],{"type":38,"value":325},{"type":33,"tag":94,"props":1585,"children":1586},{"style":132},[1587],{"type":38,"value":253},{"type":33,"tag":94,"props":1589,"children":1590},{"style":117},[1591],{"type":38,"value":140},{"type":33,"tag":94,"props":1593,"children":1594},{"style":132},[1595],{"type":38,"value":339},{"type":33,"tag":94,"props":1597,"children":1598},{"class":96,"line":683},[1599,1603,1607,1611,1615,1619,1623,1627,1632],{"type":33,"tag":94,"props":1600,"children":1601},{"style":111},[1602],{"type":38,"value":348},{"type":33,"tag":94,"props":1604,"children":1605},{"style":132},[1606],{"type":38,"value":330},{"type":33,"tag":94,"props":1608,"children":1609},{"style":117},[1610],{"type":38,"value":140},{"type":33,"tag":94,"props":1612,"children":1613},{"style":132},[1614],{"type":38,"value":192},{"type":33,"tag":94,"props":1616,"children":1617},{"style":111},[1618],{"type":38,"value":365},{"type":33,"tag":94,"props":1620,"children":1621},{"style":117},[1622],{"type":38,"value":978},{"type":33,"tag":94,"props":1624,"children":1625},{"style":111},[1626],{"type":38,"value":983},{"type":33,"tag":94,"props":1628,"children":1629},{"style":132},[1630],{"type":38,"value":1631}," 90",{"type":33,"tag":94,"props":1633,"children":1634},{"style":101},[1635],{"type":38,"value":1636},"  -- Fenêtre de 90 jours seulement\n",{"type":33,"tag":94,"props":1638,"children":1639},{"class":96,"line":696},[1640,1644,1648,1652,1656,1660],{"type":33,"tag":94,"props":1641,"children":1642},{"style":111},[1643],{"type":38,"value":379},{"type":33,"tag":94,"props":1645,"children":1646},{"style":132},[1647],{"type":38,"value":330},{"type":33,"tag":94,"props":1649,"children":1650},{"style":117},[1651],{"type":38,"value":140},{"type":33,"tag":94,"props":1653,"children":1654},{"style":132},[1655],{"type":38,"value":392},{"type":33,"tag":94,"props":1657,"children":1658},{"style":111},[1659],{"type":38,"value":325},{"type":33,"tag":94,"props":1661,"children":1662},{"style":368},[1663],{"type":38,"value":401},{"type":33,"tag":94,"props":1665,"children":1666},{"class":96,"line":717},[1667,1671,1675,1679,1683,1687,1691],{"type":33,"tag":94,"props":1668,"children":1669},{"style":111},[1670],{"type":38,"value":410},{"type":33,"tag":94,"props":1672,"children":1673},{"style":132},[1674],{"type":38,"value":415},{"type":33,"tag":94,"props":1676,"children":1677},{"style":117},[1678],{"type":38,"value":60},{"type":33,"tag":94,"props":1680,"children":1681},{"style":132},[1682],{"type":38,"value":446},{"type":33,"tag":94,"props":1684,"children":1685},{"style":117},[1686],{"type":38,"value":60},{"type":33,"tag":94,"props":1688,"children":1689},{"style":132},[1690],{"type":38,"value":1278},{"type":33,"tag":94,"props":1692,"children":1693},{"style":117},[1694],{"type":38,"value":451},{"type":33,"tag":34,"props":1696,"children":1697},{},[1698],{"type":38,"value":1699},"Quand vous interrogez une materialized view, BigQuery retourne d'abord le résultat en cache. Si une table source change (un nouvel événement est ajouté), le delta est calculé en arrière-plan. La requête du dashboard prend maintenant 0,2 secondes, le coût est de 0 dollar (cache hit). Cependant, attention : la materialized view elle-même crée un coût de stockage (BigQuery storage : 0,02$\u002FGB\u002Fmois) et si votre table de cohorte 90 jours fait 12GB, le coût de stockage mensuel supplémentaire est 0,24 dollar.",{"type":33,"tag":34,"props":1701,"children":1702},{},[1703],{"type":33,"tag":458,"props":1704,"children":1705},{},[1706],{"type":38,"value":1707},"Tableau comparatif :",{"type":33,"tag":1709,"props":1710,"children":1711},"table",{},[1712,1746],{"type":33,"tag":1713,"props":1714,"children":1715},"thead",{},[1716],{"type":33,"tag":1717,"props":1718,"children":1719},"tr",{},[1720,1726,1731,1736,1741],{"type":33,"tag":1721,"props":1722,"children":1723},"th",{},[1724],{"type":38,"value":1725},"Approche",{"type":33,"tag":1721,"props":1727,"children":1728},{},[1729],{"type":38,"value":1730},"Durée 1ère Requête",{"type":33,"tag":1721,"props":1732,"children":1733},{},[1734],{"type":38,"value":1735},"Durée Requête Dashboard",{"type":33,"tag":1721,"props":1737,"children":1738},{},[1739],{"type":38,"value":1740},"Coût Compute Mensuel",{"type":33,"tag":1721,"props":1742,"children":1743},{},[1744],{"type":38,"value":1745},"Coût Storage Mensuel",{"type":33,"tag":1747,"props":1748,"children":1749},"tbody",{},[1750,1778,1806],{"type":33,"tag":1717,"props":1751,"children":1752},{},[1753,1759,1764,1768,1773],{"type":33,"tag":1754,"props":1755,"children":1756},"td",{},[1757],{"type":38,"value":1758},"Naive JOIN",{"type":33,"tag":1754,"props":1760,"children":1761},{},[1762],{"type":38,"value":1763},"12s",{"type":33,"tag":1754,"props":1765,"children":1766},{},[1767],{"type":38,"value":1763},{"type":33,"tag":1754,"props":1769,"children":1770},{},[1771],{"type":38,"value":1772},"144 000$",{"type":33,"tag":1754,"props":1774,"children":1775},{},[1776],{"type":38,"value":1777},"0$",{"type":33,"tag":1717,"props":1779,"children":1780},{},[1781,1786,1791,1796,1801],{"type":33,"tag":1754,"props":1782,"children":1783},{},[1784],{"type":38,"value":1785},"dbt Incremental",{"type":33,"tag":1754,"props":1787,"children":1788},{},[1789],{"type":38,"value":1790},"4s (1er batch)",{"type":33,"tag":1754,"props":1792,"children":1793},{},[1794],{"type":38,"value":1795},"2s (lecture snapshot)",{"type":33,"tag":1754,"props":1797,"children":1798},{},[1799],{"type":38,"value":1800},"0,48$",{"type":33,"tag":1754,"props":1802,"children":1803},{},[1804],{"type":38,"value":1805},"0,18$ (table snapshot)",{"type":33,"tag":1717,"props":1807,"children":1808},{},[1809,1814,1819,1824,1829],{"type":33,"tag":1754,"props":1810,"children":1811},{},[1812],{"type":38,"value":1813},"Materialized View",{"type":33,"tag":1754,"props":1815,"children":1816},{},[1817],{"type":38,"value":1818},"8s (1ère build)",{"type":33,"tag":1754,"props":1820,"children":1821},{},[1822],{"type":38,"value":1823},"0,2s (cache hit)",{"type":33,"tag":1754,"props":1825,"children":1826},{},[1827],{"type":38,"value":1828},"0$ (rafraîchissement auto)",{"type":33,"tag":1754,"props":1830,"children":1831},{},[1832],{"type":38,"value":1833},"0,24$",{"type":33,"tag":34,"props":1835,"children":1836},{},[1837,1839,1844,1846,1850],{"type":38,"value":1838},"En production, la combinaison des deux est idéale : le ",{"type":33,"tag":458,"props":1840,"children":1841},{},[1842],{"type":38,"value":1843},"modèle incrémental dbt",{"type":38,"value":1845}," met à jour les cohortes historiques par batch quotidien, tandis que la ",{"type":33,"tag":458,"props":1847,"children":1848},{},[1849],{"type":38,"value":1303},{"type":38,"value":1851}," maintient les 7 derniers jours en temps réel.",{"type":33,"tag":41,"props":1853,"children":1855},{"id":1854},"partitioning-et-clustering-réduire-le-coût-des-requêtes-de-97",[1856],{"type":38,"value":1857},"Partitioning et Clustering : Réduire le Coût des Requêtes de 97%",{"type":33,"tag":34,"props":1859,"children":1860},{},[1861],{"type":38,"value":1862},"Si vous ne partitionnez et clustérisez pas vos tables de cohortes, BigQuery scanne toute la table à chaque requête. Sur une table de cohorte de 1TB (2 ans de données), une simple requête « affiche la cohorte de janvier 2026 » scanne 1TB, coûte 5 dollars. Avec partitioning + clustering, la même requête scanne 8GB, paie 0,04 dollar.",{"type":33,"tag":34,"props":1864,"children":1865},{},[1866,1871,1873,1879],{"type":33,"tag":458,"props":1867,"children":1868},{},[1869],{"type":38,"value":1870},"Stratégie de partitioning :",{"type":38,"value":1872}," Partitionnez par ",{"type":33,"tag":53,"props":1874,"children":1876},{"className":1875},[],[1877],{"type":38,"value":1878},"cohort_date",{"type":38,"value":1880}," au jour. Si BigQuery voit un filtre de partition dans la requête, il scanne uniquement les partitions concernées.",{"type":33,"tag":84,"props":1882,"children":1884},{"className":86,"code":1883,"language":88,"meta":16,"style":16},"CREATE OR REPLACE TABLE `project.dataset.cohort_retention`\nPARTITION BY cohort_date\nCLUSTER BY day_n, metric_name\nAS\nSELECT * FROM `project.dataset.cohort_retention_temp`;\n",[1885],{"type":33,"tag":53,"props":1886,"children":1887},{"__ignoreMap":16},[1888,1915,1930,1945,1952],{"type":33,"tag":94,"props":1889,"children":1890},{"class":96,"line":97},[1891,1895,1900,1905,1910],{"type":33,"tag":94,"props":1892,"children":1893},{"style":111},[1894],{"type":38,"value":1320},{"type":33,"tag":94,"props":1896,"children":1897},{"style":111},[1898],{"type":38,"value":1899}," OR",{"type":33,"tag":94,"props":1901,"children":1902},{"style":111},[1903],{"type":38,"value":1904}," REPLACE",{"type":33,"tag":94,"props":1906,"children":1907},{"style":111},[1908],{"type":38,"value":1909}," TABLE",{"type":33,"tag":94,"props":1911,"children":1912},{"style":368},[1913],{"type":38,"value":1914}," `project.dataset.cohort_retention`\n",{"type":33,"tag":94,"props":1916,"children":1917},{"class":96,"line":107},[1918,1922,1926],{"type":33,"tag":94,"props":1919,"children":1920},{"style":111},[1921],{"type":38,"value":1338},{"type":33,"tag":94,"props":1923,"children":1924},{"style":111},[1925],{"type":38,"value":1343},{"type":33,"tag":94,"props":1927,"children":1928},{"style":117},[1929],{"type":38,"value":1348},{"type":33,"tag":94,"props":1931,"children":1932},{"class":96,"line":123},[1933,1937,1941],{"type":33,"tag":94,"props":1934,"children":1935},{"style":117},[1936],{"type":38,"value":1356},{"type":33,"tag":94,"props":1938,"children":1939},{"style":111},[1940],{"type":38,"value":1361},{"type":33,"tag":94,"props":1942,"children":1943},{"style":117},[1944],{"type":38,"value":1366},{"type":33,"tag":94,"props":1946,"children":1947},{"class":96,"line":172},[1948],{"type":33,"tag":94,"props":1949,"children":1950},{"style":111},[1951],{"type":38,"value":1374},{"type":33,"tag":94,"props":1953,"children":1954},{"class":96,"line":232},[1955,1959,1964,1969,1974],{"type":33,"tag":94,"props":1956,"children":1957},{"style":111},[1958],{"type":38,"value":114},{"type":33,"tag":94,"props":1960,"children":1961},{"style":111},[1962],{"type":38,"value":1963}," *",{"type":33,"tag":94,"props":1965,"children":1966},{"style":111},[1967],{"type":38,"value":1968}," FROM",{"type":33,"tag":94,"props":1970,"children":1971},{"style":368},[1972],{"type":38,"value":1973}," `project.dataset.cohort_retention_temp`",{"type":33,"tag":94,"props":1975,"children":1976},{"style":117},[1977],{"type":38,"value":451},{"type":33,"tag":34,"props":1979,"children":1980},{},[1981,1986,1988,1994,1995,2001],{"type":33,"tag":458,"props":1982,"children":1983},{},[1984],{"type":38,"value":1985},"Clustering :",{"type":38,"value":1987}," Au sein d'une partition, si vous spécifiez les champs fréquemment filtrés (par exemple ",{"type":33,"tag":53,"props":1989,"children":1991},{"className":1990},[],[1992],{"type":38,"value":1993},"day_n",{"type":38,"value":60},{"type":33,"tag":53,"props":1996,"children":1998},{"className":1997},[],[1999],{"type":38,"value":2000},"metric_name",{"type":38,"value":2002},") comme colonnes de clustering, BigQuery effectue un pruning au niveau des blocs. Une requête « affiche la rétention jour 7 + métrique active_users » scanne uniquement les blocs pertinents.",{"type":33,"tag":34,"props":2004,"children":2005},{},[2006,2008,2014],{"type":38,"value":2007},"Exemple concret : 365 partitions (quotidiennes), chaque partition 3GB. Sans clustering, un filtre « day_7 » scanne 365 partitions × 3GB = 1TB. Avec clustering, seuls les blocs ",{"type":33,"tag":53,"props":2009,"children":2011},{"className":2010},[],[2012],{"type":38,"value":2013},"day_n=7",{"type":38,"value":2015}," sont scannés, soit 12GB au total. Différence de coût : 5$ → 0,06$.",{"type":33,"tag":34,"props":2017,"children":2018},{},[2019,2024,2026,2031,2033,2038],{"type":33,"tag":458,"props":2020,"children":2021},{},[2022],{"type":38,"value":2023},"Anti-pattern :",{"type":38,"value":2025}," Ne clustérisez pas par ",{"type":33,"tag":53,"props":2027,"children":2029},{"className":2028},[],[2030],{"type":38,"value":262},{"type":38,"value":2032},". L'analyse de cohorte n'est pas agrégation au niveau utilisateur mais au niveau cohorte. Un ordre de clustering par ",{"type":33,"tag":53,"props":2034,"children":2036},{"className":2035},[],[2037],{"type":38,"value":262},{"type":38,"value":2039}," n'aide pas le query planner et réduit même l'efficacité du cache.",{"type":33,"tag":41,"props":2041,"children":2043},{"id":2042},"identity-resolution-pour-la-précision-des-cohortes",[2044],{"type":38,"value":2045},"Identity Resolution pour la Précision des Cohortes",{"type":33,"tag":34,"props":2047,"children":2048},{},[2049,2051,2056,2058,2067,2069,2075,2077,2082],{"type":38,"value":2050},"La précision de l'analyse de cohorte dépend de la précision de ",{"type":33,"tag":53,"props":2052,"children":2054},{"className":2053},[],[2055],{"type":38,"value":262},{"type":38,"value":2057},". Quand une session anonyme (cookie) devient une session authentifiée (login), une requête naïve crée deux enregistrements de cohorte distincts. Vous résolvez ce problème via ",{"type":33,"tag":2059,"props":2060,"children":2064},"a",{"href":2061,"rel":2062},"https:\u002F\u002Fwww.roibase.com.tr\u002Ffr\u002Ffirstparty",[2063],"nofollow",[2065],{"type":38,"value":2066},"First-Party Data & Architecture de Mesure",{"type":38,"value":2068}," : construisez un graphe d'identités entre ",{"type":33,"tag":53,"props":2070,"children":2072},{"className":2071},[],[2073],{"type":38,"value":2074},"client_id",{"type":38,"value":2076}," anonyme et ",{"type":33,"tag":53,"props":2078,"children":2080},{"className":2079},[],[2081],{"type":38,"value":262},{"type":38,"value":2083}," authentifié.",{"type":33,"tag":84,"props":2085,"children":2087},{"className":86,"code":2086,"language":88,"meta":16,"style":16},"-- Table de résolution d'identités\nCREATE TABLE `project.dataset.identity_graph` (\n  canonical_user_id STRING,\n  client_id STRING,\n  user_id STRING,\n  merged_at TIMESTAMP\n)\nPARTITION BY DATE(merged_at)\nCLUSTER BY canonical_user_id;\n\n-- Joindre avec la requête de cohorte\nWITH resolved_users AS (\n  SELECT \n    COALESCE(ig.canonical_user_id, e.user_id) AS user_id,\n    e.event_date,\n    e.event_name\n  FROM events e\n  LEFT JOIN identity_graph ig \n    ON e.client_id = ig.client_id OR e.user_id = ig.user_id\n)\nSELECT \n  DATE_TRUNC(u.created_at, DAY) AS cohort_date,\n  DATE_DIFF(r.event_date, u.created_at, DAY) AS day_n,\n  COUNT(DISTINCT r.user_id) AS retained_users\nFROM resolved_users r\nJOIN users u ON r.user_id = u.user_id\nGROUP BY 1, 2;\n",[2088],{"type":33,"tag":53,"props":2089,"children":2090},{"__ignoreMap":16},[2091,2099,2119,2127,2135,2143,2156,2163,2184,2200,2207,2215,2235,2246,2301,2320,2336,2348,2361,2430,2437,2448,2487,2543,2583,2595,2639],{"type":33,"tag":94,"props":2092,"children":2093},{"class":96,"line":97},[2094],{"type":33,"tag":94,"props":2095,"children":2096},{"style":101},[2097],{"type":38,"value":2098},"-- Table de résolution d'identités\n",{"type":33,"tag":94,"props":2100,"children":2101},{"class":96,"line":107},[2102,2106,2110,2115],{"type":33,"tag":94,"props":2103,"children":2104},{"style":111},[2105],{"type":38,"value":1320},{"type":33,"tag":94,"props":2107,"children":2108},{"style":111},[2109],{"type":38,"value":1909},{"type":33,"tag":94,"props":2111,"children":2112},{"style":368},[2113],{"type":38,"value":2114}," `project.dataset.identity_graph`",{"type":33,"tag":94,"props":2116,"children":2117},{"style":117},[2118],{"type":38,"value":680},{"type":33,"tag":94,"props":2120,"children":2121},{"class":96,"line":123},[2122],{"type":33,"tag":94,"props":2123,"children":2124},{"style":117},[2125],{"type":38,"value":2126},"  canonical_user_id STRING,\n",{"type":33,"tag":94,"props":2128,"children":2129},{"class":96,"line":172},[2130],{"type":33,"tag":94,"props":2131,"children":2132},{"style":117},[2133],{"type":38,"value":2134},"  client_id STRING,\n",{"type":33,"tag":94,"props":2136,"children":2137},{"class":96,"line":232},[2138],{"type":33,"tag":94,"props":2139,"children":2140},{"style":117},[2141],{"type":38,"value":2142},"  user_id STRING,\n",{"type":33,"tag":94,"props":2144,"children":2145},{"class":96,"line":278},[2146,2151],{"type":33,"tag":94,"props":2147,"children":2148},{"style":117},[2149],{"type":38,"value":2150},"  merged_at ",{"type":33,"tag":94,"props":2152,"children":2153},{"style":111},[2154],{"type":38,"value":2155},"TIMESTAMP\n",{"type":33,"tag":94,"props":2157,"children":2158},{"class":96,"line":292},[2159],{"type":33,"tag":94,"props":2160,"children":2161},{"style":117},[2162],{"type":38,"value":1010},{"type":33,"tag":94,"props":2164,"children":2165},{"class":96,"line":342},[2166,2170,2174,2179],{"type":33,"tag":94,"props":2167,"children":2168},{"style":111},[2169],{"type":38,"value":1338},{"type":33,"tag":94,"props":2171,"children":2172},{"style":111},[2173],{"type":38,"value":1343},{"type":33,"tag":94,"props":2175,"children":2176},{"style":111},[2177],{"type":38,"value":2178}," DATE",{"type":33,"tag":94,"props":2180,"children":2181},{"style":117},[2182],{"type":38,"value":2183},"(merged_at)\n",{"type":33,"tag":94,"props":2185,"children":2186},{"class":96,"line":27},[2187,2191,2195],{"type":33,"tag":94,"props":2188,"children":2189},{"style":117},[2190],{"type":38,"value":1356},{"type":33,"tag":94,"props":2192,"children":2193},{"style":111},[2194],{"type":38,"value":1361},{"type":33,"tag":94,"props":2196,"children":2197},{"style":117},[2198],{"type":38,"value":2199}," canonical_user_id;\n",{"type":33,"tag":94,"props":2201,"children":2202},{"class":96,"line":404},[2203],{"type":33,"tag":94,"props":2204,"children":2205},{"emptyLinePlaceholder":655},[2206],{"type":38,"value":658},{"type":33,"tag":94,"props":2208,"children":2209},{"class":96,"line":427},[2210],{"type":33,"tag":94,"props":2211,"children":2212},{"style":101},[2213],{"type":38,"value":2214},"-- Joindre avec la requête de cohorte\n",{"type":33,"tag":94,"props":2216,"children":2217},{"class":96,"line":683},[2218,2222,2227,2231],{"type":33,"tag":94,"props":2219,"children":2220},{"style":111},[2221],{"type":38,"value":666},{"type":33,"tag":94,"props":2223,"children":2224},{"style":117},[2225],{"type":38,"value":2226}," resolved_users ",{"type":33,"tag":94,"props":2228,"children":2229},{"style":111},[2230],{"type":38,"value":164},{"type":33,"tag":94,"props":2232,"children":2233},{"style":117},[2234],{"type":38,"value":680},{"type":33,"tag":94,"props":2236,"children":2237},{"class":96,"line":696},[2238,2242],{"type":33,"tag":94,"props":2239,"children":2240},{"style":111},[2241],{"type":38,"value":689},{"type":33,"tag":94,"props":2243,"children":2244},{"style":117},[2245],{"type":38,"value":120},{"type":33,"tag":94,"props":2247,"children":2248},{"class":96,"line":717},[2249,2254,2258,2263,2267,2272,2276,2280,2284,2288,2292,2296],{"type":33,"tag":94,"props":2250,"children":2251},{"style":132},[2252],{"type":38,"value":2253},"    COALESCE",{"type":33,"tag":94,"props":2255,"children":2256},{"style":117},[2257],{"type":38,"value":243},{"type":33,"tag":94,"props":2259,"children":2260},{"style":132},[2261],{"type":38,"value":2262},"ig",{"type":33,"tag":94,"props":2264,"children":2265},{"style":117},[2266],{"type":38,"value":140},{"type":33,"tag":94,"props":2268,"children":2269},{"style":132},[2270],{"type":38,"value":2271},"canonical_user_id",{"type":33,"tag":94,"props":2273,"children":2274},{"style":117},[2275],{"type":38,"value":60},{"type":33,"tag":94,"props":2277,"children":2278},{"style":132},[2279],{"type":38,"value":183},{"type":33,"tag":94,"props":2281,"children":2282},{"style":117},[2283],{"type":38,"value":140},{"type":33,"tag":94,"props":2285,"children":2286},{"style":132},[2287],{"type":38,"value":262},{"type":33,"tag":94,"props":2289,"children":2290},{"style":117},[2291],{"type":38,"value":159},{"type":33,"tag":94,"props":2293,"children":2294},{"style":111},[2295],{"type":38,"value":164},{"type":33,"tag":94,"props":2297,"children":2298},{"style":117},[2299],{"type":38,"value":2300}," user_id,\n",{"type":33,"tag":94,"props":2302,"children":2303},{"class":96,"line":758},[2304,2308,2312,2316],{"type":33,"tag":94,"props":2305,"children":2306},{"style":132},[2307],{"type":38,"value":821},{"type":33,"tag":94,"props":2309,"children":2310},{"style":117},[2311],{"type":38,"value":140},{"type":33,"tag":94,"props":2313,"children":2314},{"style":132},[2315],{"type":38,"value":192},{"type":33,"tag":94,"props":2317,"children":2318},{"style":117},[2319],{"type":38,"value":544},{"type":33,"tag":94,"props":2321,"children":2322},{"class":96,"line":815},[2323,2327,2331],{"type":33,"tag":94,"props":2324,"children":2325},{"style":132},[2326],{"type":38,"value":821},{"type":33,"tag":94,"props":2328,"children":2329},{"style":117},[2330],{"type":38,"value":140},{"type":33,"tag":94,"props":2332,"children":2333},{"style":132},[2334],{"type":38,"value":2335},"event_name\n",{"type":33,"tag":94,"props":2337,"children":2338},{"class":96,"line":836},[2339,2343],{"type":33,"tag":94,"props":2340,"children":2341},{"style":111},[2342],{"type":38,"value":859},{"type":33,"tag":94,"props":2344,"children":2345},{"style":117},[2346],{"type":38,"value":2347}," events e\n",{"type":33,"tag":94,"props":2349,"children":2350},{"class":96,"line":853},[2351,2356],{"type":33,"tag":94,"props":2352,"children":2353},{"style":111},[2354],{"type":38,"value":2355},"  LEFT JOIN",{"type":33,"tag":94,"props":2357,"children":2358},{"style":117},[2359],{"type":38,"value":2360}," identity_graph ig \n",{"type":33,"tag":94,"props":2362,"children":2363},{"class":96,"line":877},[2364,2369,2373,2377,2381,2385,2390,2394,2398,2402,2406,2410,2414,2418,2422,2426],{"type":33,"tag":94,"props":2365,"children":2366},{"style":111},[2367],{"type":38,"value":2368},"    ON",{"type":33,"tag":94,"props":2370,"children":2371},{"style":132},[2372],{"type":38,"value":330},{"type":33,"tag":94,"props":2374,"children":2375},{"style":117},[2376],{"type":38,"value":140},{"type":33,"tag":94,"props":2378,"children":2379},{"style":132},[2380],{"type":38,"value":2074},{"type":33,"tag":94,"props":2382,"children":2383},{"style":111},[2384],{"type":38,"value":325},{"type":33,"tag":94,"props":2386,"children":2387},{"style":132},[2388],{"type":38,"value":2389}," ig",{"type":33,"tag":94,"props":2391,"children":2392},{"style":117},[2393],{"type":38,"value":140},{"type":33,"tag":94,"props":2395,"children":2396},{"style":132},[2397],{"type":38,"value":2074},{"type":33,"tag":94,"props":2399,"children":2400},{"style":111},[2401],{"type":38,"value":1899},{"type":33,"tag":94,"props":2403,"children":2404},{"style":132},[2405],{"type":38,"value":330},{"type":33,"tag":94,"props":2407,"children":2408},{"style":117},[2409],{"type":38,"value":140},{"type":33,"tag":94,"props":2411,"children":2412},{"style":132},[2413],{"type":38,"value":262},{"type":33,"tag":94,"props":2415,"children":2416},{"style":111},[2417],{"type":38,"value":325},{"type":33,"tag":94,"props":2419,"children":2420},{"style":132},[2421],{"type":38,"value":2389},{"type":33,"tag":94,"props":2423,"children":2424},{"style":117},[2425],{"type":38,"value":140},{"type":33,"tag":94,"props":2427,"children":2428},{"style":132},[2429],{"type":38,"value":339},{"type":33,"tag":94,"props":2431,"children":2432},{"class":96,"line":932},[2433],{"type":33,"tag":94,"props":2434,"children":2435},{"style":117},[2436],{"type":38,"value":1010},{"type":33,"tag":94,"props":2438,"children":2439},{"class":96,"line":951},[2440,2444],{"type":33,"tag":94,"props":2441,"children":2442},{"style":111},[2443],{"type":38,"value":114},{"type":33,"tag":94,"props":2445,"children":2446},{"style":117},[2447],{"type":38,"value":120},{"type":33,"tag":94,"props":2449,"children":2450},{"class":96,"line":995},[2451,2455,2459,2463,2467,2471,2475,2479,2483],{"type":33,"tag":94,"props":2452,"children":2453},{"style":117},[2454],{"type":38,"value":129},{"type":33,"tag":94,"props":2456,"children":2457},{"style":132},[2458],{"type":38,"value":135},{"type":33,"tag":94,"props":2460,"children":2461},{"style":117},[2462],{"type":38,"value":140},{"type":33,"tag":94,"props":2464,"children":2465},{"style":132},[2466],{"type":38,"value":145},{"type":33,"tag":94,"props":2468,"children":2469},{"style":117},[2470],{"type":38,"value":60},{"type":33,"tag":94,"props":2472,"children":2473},{"style":111},[2474],{"type":38,"value":154},{"type":33,"tag":94,"props":2476,"children":2477},{"style":117},[2478],{"type":38,"value":159},{"type":33,"tag":94,"props":2480,"children":2481},{"style":111},[2482],{"type":38,"value":164},{"type":33,"tag":94,"props":2484,"children":2485},{"style":117},[2486],{"type":38,"value":169},{"type":33,"tag":94,"props":2488,"children":2489},{"class":96,"line":1004},[2490,2494,2499,2503,2507,2511,2515,2519,2523,2527,2531,2535,2539],{"type":33,"tag":94,"props":2491,"children":2492},{"style":117},[2493],{"type":38,"value":178},{"type":33,"tag":94,"props":2495,"children":2496},{"style":132},[2497],{"type":38,"value":2498},"r",{"type":33,"tag":94,"props":2500,"children":2501},{"style":117},[2502],{"type":38,"value":140},{"type":33,"tag":94,"props":2504,"children":2505},{"style":132},[2506],{"type":38,"value":192},{"type":33,"tag":94,"props":2508,"children":2509},{"style":117},[2510],{"type":38,"value":60},{"type":33,"tag":94,"props":2512,"children":2513},{"style":132},[2514],{"type":38,"value":135},{"type":33,"tag":94,"props":2516,"children":2517},{"style":117},[2518],{"type":38,"value":140},{"type":33,"tag":94,"props":2520,"children":2521},{"style":132},[2522],{"type":38,"value":145},{"type":33,"tag":94,"props":2524,"children":2525},{"style":117},[2526],{"type":38,"value":60},{"type":33,"tag":94,"props":2528,"children":2529},{"style":111},[2530],{"type":38,"value":154},{"type":33,"tag":94,"props":2532,"children":2533},{"style":117},[2534],{"type":38,"value":159},{"type":33,"tag":94,"props":2536,"children":2537},{"style":111},[2538],{"type":38,"value":164},{"type":33,"tag":94,"props":2540,"children":2541},{"style":117},[2542],{"type":38,"value":229},{"type":33,"tag":94,"props":2544,"children":2545},{"class":96,"line":1013},[2546,2550,2554,2558,2563,2567,2571,2575,2579],{"type":33,"tag":94,"props":2547,"children":2548},{"style":132},[2549],{"type":38,"value":238},{"type":33,"tag":94,"props":2551,"children":2552},{"style":117},[2553],{"type":38,"value":243},{"type":33,"tag":94,"props":2555,"children":2556},{"style":111},[2557],{"type":38,"value":248},{"type":33,"tag":94,"props":2559,"children":2560},{"style":132},[2561],{"type":38,"value":2562}," r",{"type":33,"tag":94,"props":2564,"children":2565},{"style":117},[2566],{"type":38,"value":140},{"type":33,"tag":94,"props":2568,"children":2569},{"style":132},[2570],{"type":38,"value":262},{"type":33,"tag":94,"props":2572,"children":2573},{"style":117},[2574],{"type":38,"value":159},{"type":33,"tag":94,"props":2576,"children":2577},{"style":111},[2578],{"type":38,"value":164},{"type":33,"tag":94,"props":2580,"children":2581},{"style":117},[2582],{"type":38,"value":275},{"type":33,"tag":94,"props":2584,"children":2585},{"class":96,"line":1022},[2586,2590],{"type":33,"tag":94,"props":2587,"children":2588},{"style":111},[2589],{"type":38,"value":284},{"type":33,"tag":94,"props":2591,"children":2592},{"style":117},[2593],{"type":38,"value":2594}," resolved_users r\n",{"type":33,"tag":94,"props":2596,"children":2597},{"class":96,"line":1031},[2598,2602,2607,2611,2615,2619,2623,2627,2631,2635],{"type":33,"tag":94,"props":2599,"children":2600},{"style":111},[2601],{"type":38,"value":298},{"type":33,"tag":94,"props":2603,"children":2604},{"style":117},[2605],{"type":38,"value":2606}," users u ",{"type":33,"tag":94,"props":2608,"children":2609},{"style":111},[2610],{"type":38,"value":308},{"type":33,"tag":94,"props":2612,"children":2613},{"style":132},[2614],{"type":38,"value":2562},{"type":33,"tag":94,"props":2616,"children":2617},{"style":117},[2618],{"type":38,"value":140},{"type":33,"tag":94,"props":2620,"children":2621},{"style":132},[2622],{"type":38,"value":262},{"type":33,"tag":94,"props":2624,"children":2625},{"style":111},[2626],{"type":38,"value":325},{"type":33,"tag":94,"props":2628,"children":2629},{"style":132},[2630],{"type":38,"value":253},{"type":33,"tag":94,"props":2632,"children":2633},{"style":117},[2634],{"type":38,"value":140},{"type":33,"tag":94,"props":2636,"children":2637},{"style":132},[2638],{"type":38,"value":339},{"type":33,"tag":94,"props":2640,"children":2641},{"class":96,"line":1040},[2642,2646,2650,2654,2658],{"type":33,"tag":94,"props":2643,"children":2644},{"style":111},[2645],{"type":38,"value":410},{"type":33,"tag":94,"props":2647,"children":2648},{"style":132},[2649],{"type":38,"value":415},{"type":33,"tag":94,"props":2651,"children":2652},{"style":117},[2653],{"type":38,"value":60},{"type":33,"tag":94,"props":2655,"children":2656},{"style":132},[2657],{"type":38,"value":446},{"type":33,"tag":94,"props":2659,"children":2660},{"style":117},[2661],{"type":38,"value":451},{"type":33,"tag":34,"props":2663,"children":2664},{},[2665],{"type":38,"value":2666},"Sans identity resolution, les cohortes se gonflent de 12-18% (un utilisateur est enregistré sous deux ID différents). Cette erreur fait paraître les métriques de rétention basses, car le dénominateur (taille de la cohorte) s'agrandit mais l'activité au jour n reste identique.",{"type":33,"tag":41,"props":2668,"children":2670},{"id":2669},"suivi-du-coût-des-requêtes-monitoring-production-via-information_schema",[2671],{"type":38,"value":2672},"Suivi du Coût des Requêtes : Monitoring Production via INFORMATION_SCHEMA",{"type":33,"tag":34,"props":2674,"children":2675},{},[2676,2678,2684],{"type":38,"value":2677},"Une fois votre architecture de cohortes mise en place, vous devez continuellement optimiser le coût des requêtes. La table ",{"type":33,"tag":53,"props":2679,"children":2681},{"className":2680},[],[2682],{"type":38,"value":2683},"INFORMATION_SCHEMA.JOBS",{"type":38,"value":2685}," de BigQuery affiche le nombre de bytes scanné par chaque requête, l'utilisation des slots et le coût total.",{"type":33,"tag":84,"props":2687,"children":2689},{"className":86,"code":2688,"language":88,"meta":16,"style":16},"SELECT\n  user_email,\n  query,\n  total_bytes_processed \u002F POW(10, 12) AS tb_processed,\n  (total_bytes_processed \u002F POW(10, 12)) * 5 AS cost_usd,\n  total_slot_ms \u002F 1000 \u002F 60 AS slot_minutes\nFROM `region-us`.INFORMATION_SCHEMA.JOBS_BY_PROJECT\nWHERE creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY)\n  AND statement_type = 'SELECT'\n  AND query LIKE '%cohort_retention%'\nORDER BY total_bytes_processed DESC\nLIMIT 20;\n",[2690],{"type":33,"tag":53,"props":2691,"children":2692},{"__ignoreMap":16},[2693,2700,2708,2716,2761,2813,2849,2879,2925,2946,2968,2985],{"type":33,"tag":94,"props":2694,"children":2695},{"class":96,"line":97},[2696],{"type":33,"tag":94,"props":2697,"children":2698},{"style":111},[2699],{"type":38,"value":1019},{"type":33,"tag":94,"props":2701,"children":2702},{"class":96,"line":107},[2703],{"type":33,"tag":94,"props":2704,"children":2705},{"style":117},[2706],{"type":38,"value":2707},"  user_email,\n",{"type":33,"tag":94,"props":2709,"children":2710},{"class":96,"line":123},[2711],{"type":33,"tag":94,"props":2712,"children":2713},{"style":117},[2714],{"type":38,"value":2715},"  query,\n",{"type":33,"tag":94,"props":2717,"children":2718},{"class":96,"line":172},[2719,2724,2729,2734,2739,2743,2748,2752,2756],{"type":33,"tag":94,"props":2720,"children":2721},{"style":117},[2722],{"type":38,"value":2723},"  total_bytes_processed ",{"type":33,"tag":94,"props":2725,"children":2726},{"style":111},[2727],{"type":38,"value":2728},"\u002F",{"type":33,"tag":94,"props":2730,"children":2731},{"style":117},[2732],{"type":38,"value":2733}," POW(",{"type":33,"tag":94,"props":2735,"children":2736},{"style":132},[2737],{"type":38,"value":2738},"10",{"type":33,"tag":94,"props":2740,"children":2741},{"style":117},[2742],{"type":38,"value":60},{"type":33,"tag":94,"props":2744,"children":2745},{"style":132},[2746],{"type":38,"value":2747},"12",{"type":33,"tag":94,"props":2749,"children":2750},{"style":117},[2751],{"type":38,"value":159},{"type":33,"tag":94,"props":2753,"children":2754},{"style":111},[2755],{"type":38,"value":164},{"type":33,"tag":94,"props":2757,"children":2758},{"style":117},[2759],{"type":38,"value":2760}," tb_processed,\n",{"type":33,"tag":94,"props":2762,"children":2763},{"class":96,"line":232},[2764,2769,2773,2777,2781,2785,2789,2794,2799,2804,2808],{"type":33,"tag":94,"props":2765,"children":2766},{"style":117},[2767],{"type":38,"value":2768},"  (total_bytes_processed ",{"type":33,"tag":94,"props":2770,"children":2771},{"style":111},[2772],{"type":38,"value":2728},{"type":33,"tag":94,"props":2774,"children":2775},{"style":117},[2776],{"type":38,"value":2733},{"type":33,"tag":94,"props":2778,"children":2779},{"style":132},[2780],{"type":38,"value":2738},{"type":33,"tag":94,"props":2782,"children":2783},{"style":117},[2784],{"type":38,"value":60},{"type":33,"tag":94,"props":2786,"children":2787},{"style":132},[2788],{"type":38,"value":2747},{"type":33,"tag":94,"props":2790,"children":2791},{"style":117},[2792],{"type":38,"value":2793},")) ",{"type":33,"tag":94,"props":2795,"children":2796},{"style":111},[2797],{"type":38,"value":2798},"*",{"type":33,"tag":94,"props":2800,"children":2801},{"style":132},[2802],{"type":38,"value":2803}," 5",{"type":33,"tag":94,"props":2805,"children":2806},{"style":111},[2807],{"type":38,"value":1051},{"type":33,"tag":94,"props":2809,"children":2810},{"style":117},[2811],{"type":38,"value":2812}," cost_usd,\n",{"type":33,"tag":94,"props":2814,"children":2815},{"class":96,"line":278},[2816,2821,2825,2830,2835,2840,2844],{"type":33,"tag":94,"props":2817,"children":2818},{"style":117},[2819],{"type":38,"value":2820},"  total_slot_ms ",{"type":33,"tag":94,"props":2822,"children":2823},{"style":111},[2824],{"type":38,"value":2728},{"type":33,"tag":94,"props":2826,"children":2827},{"style":132},[2828],{"type":38,"value":2829}," 1000",{"type":33,"tag":94,"props":2831,"children":2832},{"style":111},[2833],{"type":38,"value":2834}," \u002F",{"type":33,"tag":94,"props":2836,"children":2837},{"style":132},[2838],{"type":38,"value":2839}," 60",{"type":33,"tag":94,"props":2841,"children":2842},{"style":111},[2843],{"type":38,"value":1051},{"type":33,"tag":94,"props":2845,"children":2846},{"style":117},[2847],{"type":38,"value":2848}," slot_minutes\n",{"type":33,"tag":94,"props":2850,"children":2851},{"class":96,"line":292},[2852,2856,2861,2865,2870,2874],{"type":33,"tag":94,"props":2853,"children":2854},{"style":111},[2855],{"type":38,"value":284},{"type":33,"tag":94,"props":2857,"children":2858},{"style":368},[2859],{"type":38,"value":2860}," `region-us`",{"type":33,"tag":94,"props":2862,"children":2863},{"style":117},[2864],{"type":38,"value":140},{"type":33,"tag":94,"props":2866,"children":2867},{"style":132},[2868],{"type":38,"value":2869},"INFORMATION_SCHEMA",{"type":33,"tag":94,"props":2871,"children":2872},{"style":117},[2873],{"type":38,"value":140},{"type":33,"tag":94,"props":2875,"children":2876},{"style":132},[2877],{"type":38,"value":2878},"JOBS_BY_PROJECT\n",{"type":33,"tag":94,"props":2880,"children":2881},{"class":96,"line":342},[2882,2886,2891,2896,2901,2906,2911,2916,2921],{"type":33,"tag":94,"props":2883,"children":2884},{"style":111},[2885],{"type":38,"value":348},{"type":33,"tag":94,"props":2887,"children":2888},{"style":117},[2889],{"type":38,"value":2890}," creation_time ",{"type":33,"tag":94,"props":2892,"children":2893},{"style":111},[2894],{"type":38,"value":2895},">=",{"type":33,"tag":94,"props":2897,"children":2898},{"style":117},[2899],{"type":38,"value":2900}," TIMESTAMP_SUB(",{"type":33,"tag":94,"props":2902,"children":2903},{"style":132},[2904],{"type":38,"value":2905},"CURRENT_TIMESTAMP",{"type":33,"tag":94,"props":2907,"children":2908},{"style":117},[2909],{"type":38,"value":2910},"(), INTERVAL ",{"type":33,"tag":94,"props":2912,"children":2913},{"style":132},[2914],{"type":38,"value":2915},"7",{"type":33,"tag":94,"props":2917,"children":2918},{"style":111},[2919],{"type":38,"value":2920}," DAY",{"type":33,"tag":94,"props":2922,"children":2923},{"style":117},[2924],{"type":38,"value":1010},{"type":33,"tag":94,"props":2926,"children":2927},{"class":96,"line":27},[2928,2932,2937,2941],{"type":33,"tag":94,"props":2929,"children":2930},{"style":111},[2931],{"type":38,"value":379},{"type":33,"tag":94,"props":2933,"children":2934},{"style":117},[2935],{"type":38,"value":2936}," statement_type ",{"type":33,"tag":94,"props":2938,"children":2939},{"style":111},[2940],{"type":38,"value":534},{"type":33,"tag":94,"props":2942,"children":2943},{"style":368},[2944],{"type":38,"value":2945}," 'SELECT'\n",{"type":33,"tag":94,"props":2947,"children":2948},{"class":96,"line":404},[2949,2953,2958,2963],{"type":33,"tag":94,"props":2950,"children":2951},{"style":111},[2952],{"type":38,"value":379},{"type":33,"tag":94,"props":2954,"children":2955},{"style":117},[2956],{"type":38,"value":2957}," query ",{"type":33,"tag":94,"props":2959,"children":2960},{"style":111},[2961],{"type":38,"value":2962},"LIKE",{"type":33,"tag":94,"props":2964,"children":2965},{"style":368},[2966],{"type":38,"value":2967}," '%cohort_retention%'\n",{"type":33,"tag":94,"props":2969,"children":2970},{"class":96,"line":427},[2971,2975,2980],{"type":33,"tag":94,"props":2972,"children":2973},{"style":111},[2974],{"type":38,"value":433},{"type":33,"tag":94,"props":2976,"children":2977},{"style":117},[2978],{"type":38,"value":2979}," total_bytes_processed ",{"type":33,"tag":94,"props":2981,"children":2982},{"style":111},[2983],{"type":38,"value":2984},"DESC\n",{"type":33,"tag":94,"props":2986,"children":2987},{"class":96,"line":683},[2988,2993,2998],{"type":33,"tag":94,"props":2989,"children":2990},{"style":111},[2991],{"type":38,"value":2992},"LIMIT",{"type":33,"tag":94,"props":2994,"children":2995},{"style":132},[2996],{"type":38,"value":2997}," 20",{"type":33,"tag":94,"props":2999,"children":3000},{"style":117},[3001],{"type":38,"value":451},{"type":33,"tag":34,"props":3003,"children":3004},{},[3005,3007,3013],{"type":38,"value":3006},"Cette requête liste les 7 derniers jours de requêtes sur vos tables de cohortes, triées par coût. Si un panneau de dashboard s'exécute 500 fois par jour et scanne 80GB à chaque fois (filtre de partition manquant), vous avez 500 × 80GB × 5$\u002FTB = 200$ de coût quotidien. Dans ce cas, ajouter un filtre ",{"type":33,"tag":53,"props":3008,"children":3010},{"className":3009},[],[3011],{"type":38,"value":3012},"WHERE cohort_date >= CURRENT_DATE() - 30",{"type":38,"value":3014}," au query du panneau réduit le coût à 6$.",{"type":33,"tag":34,"props":3016,"children":3017},{},[3018],{"type":33,"tag":458,"props":3019,"children":3020},{},[3021],{"type":38,"value":3022},"Checklist de production :",{"type":33,"tag":3024,"props":3025,"children":3028},"ul",{"className":3026},[3027],"contains-task-list",[3029,3049,3071,3080,3089,3105],{"type":33,"tag":3030,"props":3031,"children":3034},"li",{"className":3032},[3033],"task-list-item",[3035,3040,3042,3047],{"type":33,"tag":3036,"props":3037,"children":3039},"input",{"disabled":655,"type":3038},"checkbox",[],{"type":38,"value":3041}," Toutes les tables de cohortes sont-elles partitionnées par ",{"type":33,"tag":53,"props":3043,"children":3045},{"className":3044},[],[3046],{"type":38,"value":1878},{"type":38,"value":3048}," ?",{"type":33,"tag":3030,"props":3050,"children":3052},{"className":3051},[3033],[3053,3056,3058,3063,3064,3069],{"type":33,"tag":3036,"props":3054,"children":3055},{"disabled":655,"type":3038},[],{"type":38,"value":3057}," ",{"type":33,"tag":53,"props":3059,"children":3061},{"className":3060},[],[3062],{"type":38,"value":1993},{"type":38,"value":464},{"type":33,"tag":53,"props":3065,"children":3067},{"className":3066},[],[3068],{"type":38,"value":2000},{"type":38,"value":3070}," sont-ils clustérisés ?",{"type":33,"tag":3030,"props":3072,"children":3074},{"className":3073},[3033],[3075,3078],{"type":33,"tag":3036,"props":3076,"children":3077},{"disabled":655,"type":3038},[],{"type":38,"value":3079}," Le job dbt incremental s'exécute-t-il quotidiennement ?",{"type":33,"tag":3030,"props":3081,"children":3083},{"className":3082},[3033],[3084,3087],{"type":33,"tag":3036,"props":3085,"children":3086},{"disabled":655,"type":3038},[],{"type":38,"value":3088}," La materialized view est-elle limitée à une fenêtre de 90 jours ?",{"type":33,"tag":3030,"props":3090,"children":3092},{"className":3091},[3033],[3093,3096,3098,3104],{"type":33,"tag":3036,"props":3094,"children":3095},{"disabled":655,"type":3038},[],{"type":38,"value":3097}," Les requêtes du dashboard contiennent-elles un filtre ",{"type":33,"tag":53,"props":3099,"children":3101},{"className":3100},[],[3102],{"type":38,"value":3103},"WHERE cohort_date >= ...",{"type":38,"value":3048},{"type":33,"tag":3030,"props":3106,"children":3108},{"className":3107},[3033],[3109,3112,3114,3119],{"type":33,"tag":3036,"props":3110,"children":3111},{"disabled":655,"type":3038},[],{"type":38,"value":3113}," Générez-vous un rapport de coût hebdomadaire via ",{"type":33,"tag":53,"props":3115,"children":3117},{"className":3116},[],[3118],{"type":38,"value":2869},{"type":38,"value":3048},{"type":33,"tag":34,"props":3121,"children":3122},{},[3123],{"type":38,"value":3124},"Quand l'architecture de cohortes est correctement construite, l'analyse de rétention devient production-ready : 100M d'événements quotidiens, requêtes en 5 secondes, coût compute mensuel de 10 dollars. Cependant, cette architecture requiert identity resolution first-party, standardisation de schéma d'événements et discipline du pipeline dbt — c'est pourquoi l'engineering de rétention est une plateforme, pas du SQL ponctuel.",{"type":33,"tag":3126,"props":3127,"children":3128},"style",{},[3129],{"type":38,"value":3130},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":16,"searchDepth":123,"depth":123,"links":3132},[3133,3136,3137,3138,3139],{"id":43,"depth":107,"text":46,"children":3134},[3135],{"id":474,"depth":123,"text":477},{"id":1290,"depth":107,"text":1293},{"id":1854,"depth":107,"text":1857},{"id":2042,"depth":107,"text":2045},{"id":2669,"depth":107,"text":2672},"markdown","content:fr:data:cohort-table-architecture-production-scaling.md","content","fr\u002Fdata\u002Fcohort-table-architecture-production-scaling.md","fr\u002Fdata\u002Fcohort-table-architecture-production-scaling","md",1782079493948]