Schema: clicks (session_id, event_time, url, user_agent, ip) partitioned by event_date.
Task: Find top-10 active users by session duration. tutorial presto 8.8
WITH session_bounds AS (
SELECT
session_id,
MIN(event_time) AS start_time,
MAX(event_time) AS end_time,
COUNT(*) AS clicks
FROM clicks
WHERE event_date BETWEEN '2025-04-20' AND '2025-04-27'
GROUP BY session_id
)
SELECT
session_id,
date_diff('second', start_time, end_time) AS duration_sec,
clicks,
RANK() OVER (ORDER BY date_diff('second', start_time, end_time) DESC) AS rank
FROM session_bounds
ORDER BY duration_sec DESC
LIMIT 10;
Let's simulate a large aggregation. Presto 8.8 will automatically use the vectorized engine if enabled. Let's simulate a large aggregation
-- Switch to the Iceberg catalog (assuming you have a 'sales' table) USE iceberg.default;
-- Sample query leveraging 8.8's vectorization SELECT region, COUNT(*) AS total_sales, SUM(amount) AS revenue FROM sales WHERE sale_date BETWEEN DATE '2024-01-01' AND DATE '2024-12-31' GROUP BY region ORDER BY revenue DESC;Check the Query Execution Timeline in the Web UI
Check the Query Execution Timeline in the Web UI. You should see "Vectorized Operators" lit up.
While Presto 8.8 is secure for its intended purpose, using legacy software requires vigilance: