Redshift serverless charged_seconds and compute_seconds

802 Views Asked by At

I am trying to understand pricing for Redshift Serverless but slightly confused between compute_seconds and charged_seconds.

I have currently set base RPU to 128 which is the default.

I have have executed certain queries and after that have queried the sys_serverless_usage view and I see the below results

enter image description here

below are some of my questions

  1. Does compute_seconds refer to the number of seconds it took for the query to execute?
  2. what's the difference between charged_seconds and compute_seconds. On row 6 i see that compute_seconds is 0 but charged_seconds are 7680.

Any help here would be great, thanks.

2

There are 2 best solutions below

2
On
  1. Yes, compute would be the number of seconds to execute the query

  2. Charged seconds could be rounded up based on the minimum billing of 60 seconds. 128 RPU * 60 seconds = 7680

0
On

So you are charged at minimum for 60 seconds of compute, that means for each time interval of 1 minute (like in the table) you will be charged 60sec * compute_capacity

60 * 128 = 7680

So because your base RPU is set to 128 ~ when you run queries it will take the seconds that Serverless is running and multiply it by 128

For example the 3rd row your compute seconds is 3799 and 128 rpu

3799 / 128  = 29.67 seconds

so essentially for each row you can take the compute_capacity and use that do derrive seconds that cluster was running compute_seconds / compute_capacity and the charged_seconds is essentially showing you what you are going to be billed each minute (due to 1 minute min billing)

so at 128 RPU each minute at 0.375 Per RPU Hour thats

 7680 / 3600 * 0.375 = 0.79c Per minute

so WHENVER you run some queries at 128 Base RPU you are going to be charged 79c for each minute the cluster is in use, even if you run 1 query that finishes in 200ms you will be charged for the full minute, alternatively if you run 50 queries concurrently at 128 RPU and they all complete in 30secs within the same minute, you will be still only charged 79c