Query Seconds
Last updated
Was this helpful?
Last updated
Was this helpful?
Query Seconds represent computational time against Flipside's data warehouse, canonically referred to as a DataSource. Every QueryRun has the following life cycle.
A query run that is in the state QUERY_STATE_READY
has been queued for execution. Once it begins execution it transitions to QUERY_STATE_RUNNING
. From here it can transition to a number of states. If the query executes against the data source successfully it will transition to QUERY_STATE_STREAMING_RESULTS
and begin downloading the query results for you to export.
If the query failed for any reason (syntax error, warehouse issue, etc.) the query will transition to a state of QUERY_STATE_FAILED
. If the user decides to explicitly cancel the query the query run will be terminated and its state will transition to QUERY_STATE_CANCELED
. Finally, if the QueryRun finishes downloading its results from the data source it will transition to QUERY_STATE_SUCCESS
.
Given the above life-cycle for a QueryRun, let's walk thru a real example to determine how you might be billed for a query. Here is a query we're going to execute to find the address associated with an ENS domain.
This query will produce four different time stamps:
TotalElapsedSeconds - the time difference between a terminal state (QUERY_STATE_SUCCESS
, QUERY_STATE_FAILED
or QUERY_STATE_CANCELED
), and QUERY_STATE_READY
.
StreamingSeconds - the time difference between QUERY_STATE_SUCCESS
and QUERY_STATE_STREAMING_RESULTS
ExecutionSeconds - the time difference between QUERY_STATE_STREAMING_RESULTS
and QUERY_STATE_RUNNING
QueuedSeconds - the time difference between QUERY_STATE_READY
and QUERY_STATE_RUNNING
Let's assume this Query has never been executed, meaning no results exist, and as a result, a billable QueryRun is created.
This QueryRun executes successfully for a total of 18 seconds, here is the breakdown:
StreamingSeconds
4
ExecutionSeconds
12
QueuedSeconds
1
Since you are only billed for ExecutionSeconds you would be debited for 12 seconds. At a rate of $0.02 per query second, you would be billed $0.24 (12 Execution Query Seconds * $0.02/query second).