Here is my table sampletable4 (Just a sample). My table is millions of data.:
app_id latency -- app_id is char(255), latency is float
| 1111 | 0.940056 |
| 1110 | 0.261509 |
| 3211 | 0.0506242 |
| 3210 | 0.468594 |
| 3110 | 0.191095 |
Where app_id is a string and latency is float. The latency measures how fast an API call for each app.
I would like to print out the slowest (or highest latency) for each app_id. My query does not limit to slowest 5%. I want to limit the query to slowest 5% of each app_id.
Here is my query:
SELECT
latency
FROM sampleTable4
WHERE app_id = '5697'
ORDER BY latency DESC;
It is a specific case for app_id = '5697'. How would I change it so it print out 5% of the latency?