{"slug":"rest-polling-vs-websocket-market-data","qid":"updates_per_second","label":"NVDA quote updates per second, grouped by how busy the second was","post_title":"REST Polling vs WebSockets for Market Data","post_url":"/blog/rest-polling-vs-websocket-market-data#q-updates_per_second","columns":["updates_in_the_second","share_of_seconds_pct","share_of_messages_pct"],"rows":[{"updates_in_the_second":"1 update","share_of_seconds_pct":0.2,"share_of_messages_pct":0},{"updates_in_the_second":"2 to 5","share_of_seconds_pct":1.7,"share_of_messages_pct":0.1},{"updates_in_the_second":"6 to 20","share_of_seconds_pct":8.1,"share_of_messages_pct":1.3},{"updates_in_the_second":"21 to 100","share_of_seconds_pct":62.4,"share_of_messages_pct":42.9},{"updates_in_the_second":"over 100","share_of_seconds_pct":27.6,"share_of_messages_pct":55.8}],"shape":"ranking","sql":"WITH\n    per_second AS\n    (\n        SELECT\n            toDateTime(sip_timestamp) AS second_bucket,\n            count()                   AS messages\n        FROM global_markets.cache_stocks_quotes\n        WHERE ticker = 'NVDA'\n          AND sip_timestamp >= '2026-09-15 13:30:00'\n          AND sip_timestamp <  '2026-09-15 15:30:00'\n        GROUP BY second_bucket\n    ),\n    totals AS\n    (\n        SELECT\n            count()       AS second_count,\n            sum(messages) AS message_count\n        FROM per_second\n    )\nSELECT\n    multiIf(messages = 1,    '1 update',\n            messages <= 5,   '2 to 5',\n            messages <= 20,  '6 to 20',\n            messages <= 100, '21 to 100',\n            'over 100')                                                  AS updates_in_the_second,\n    round(100.0 * count() / (SELECT second_count FROM totals), 1)         AS share_of_seconds_pct,\n    round(100.0 * sum(messages) / (SELECT message_count FROM totals), 1) AS share_of_messages_pct\nFROM per_second\nGROUP BY updates_in_the_second\nORDER BY min(messages)","computed_at":"2026-10-09T15:25:31.140558+00:00","elapsed":0.003266479}