Is there a reason why the same query executed a number of times have huge variance in response times? from 50% - 200% what the projected response time is? They range from 6 seconds to 20 seconds even though it is the only active query in the database.

Context:

1. Database on Postgres 9.6 on AWS RDS (with Provisioned IOPS)
2. Contains one table comprising five numeric columns, indexed on id, holding 200 million rows

The query:

`SELECT col1, col2 
 FROM calculations 
 WHERE id > 0 
 AND id < 100000;`

The query's explain plan:

`Bitmap Heap Scan on calculation (cost=2419.37..310549.65 rows=99005 width=43)
 Recheck Cond: ((id > 0) AND (id <= 100000))
 -> Bitmap Index Scan on calculation_pkey (cost=0.00..2394.62 rows=99005 width=0)
 Index Cond: ((id > 0) AND (id <= 100000))`

Is there any reasons why a simple query like this isn't more predictable in response time?

Thanks.
['https://Stackoverflow.com/questions/45949267', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8534637/']
A query may be (and should be, excluding special cases) more predictable in response time when you are a sole user of the server. In the case of a cloud server, you do not know anything about the actual server load, even if your query is the only one performed on your database, because the server most likely supports multiple databases at the same time. As you asked about *response time*, there may be also various circumstances involved in accessing a remote server over the network.
After investigation of the historical load, we have found out that the provisioned IOPS we originally configured had been exhausted during the last set of load tests performed on the environment.

According to Amazon's documentation @<http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html>, after this point, Amazon does not guarantee consistency in execution times and the SLAs are no longer applicable. 

We have confirmed that replicating the database onto a new instance of AWS RDS with same configuration yields consistent response times when executing the query multiple times.