latency_p50, approx_percentile(latency, 0.95) AS latency_p95 FROM ( SELECT request_verb AS http_method, url_extract_path(request_url) AS path, request_processing_time + target_processing_time + response_processing_time AS latency FROM [ログテーブル名] WHERE day >= date_format(date_add('day', -28, current_timestamp), '%Y/%m/%d') AND from_iso8601_timestamp(time) >= date_add('day', -28, current_timestamp) AND (elb_status_code < 500 AND elb_status_code <> 429) AND (request_processing_time + target_processing_time + response_processing_time) > 0 ) t GROUP BY http_method, path ORDER BY count(*) DESC LIMIT 10