Link: Daily click rollups for analytics and record clicks after the redirect
/api/links/analytics takes 23 ms with only 6,000 clicks, 5 times slower than any other list endpoint (measured). The plan joins links and clicks and builds a temp B-tree for GROUP BY, so it grows linearly with clicks. recordClick (lib/track.ts:145) also writes synchronously before the 302, which on Turso adds a round-trip to every redirect. Dub keeps clicks in a separate events store. First scope: a link_clicks_daily(link_id, day, country, device, referrer, count) table updated in the same batch, analytics reading from it, and the clicks INSERT moved into after(). Priority: medium. Effort: M.
Comentarios 0
Sin comentarios todavía.
Ingresá para comentar