Pricing system table reference
This article provides you with an overview of the pricing system table, including the schema and example queries. The pricing table gives you access to a historical log of SKU pricing. A record gets added each time there is a change to a SKU price. These logs can help you perform cost analysis and monitor pricing changes.
The pricing system table is located at system.billing.list_prices
.
Pricing table schema
The pricing system table uses the following schema:
Column name |
Data type |
Description |
Example |
---|---|---|---|
|
timestamp |
The time this price became effective in UTC |
|
|
timestamp |
The time this price stopped being effective in UTC |
|
|
string |
ID of the account this report was generated for |
|
|
string |
Name of the SKU |
|
|
string |
Name of the Cloud this price is applicable to. Possible values are |
|
|
string |
The currency this price is expressed in |
|
|
string |
The unit of measurement that is monetized. |
|
|
struct |
A structured data field that includes pricing info at the published list price rate. The key |
|
Sample queries
You can use the following sample queries to answer common questions about SKU pricing:
Find the list price of a particular SKU on a particular date
View total cost of everything that used a particular custom tag during the previous calendar month
Estimate the add-on costs for usage in the previous calendar month
For examples queries concerning job cost observability, see Monitor job costs with system tables.
Find the list price of a particular SKU on a particular date
Since the table only contains records for times when the SKU price changes, you have to look up the most recent price change on or before the date.
SELECT sku_name, price_start_time, pricing.default
FROM system.billing.list_prices
WHERE sku_name = 'STANDARD_ALL_PURPOSE_COMPUTE'
AND price_start_time <= "2023-01-01"
ORDER BY price_start_time DESC
LIMIT 1
View total cost of everything that used a particular custom tag during the previous calendar month
Note
Be sure to replace the custom tag’s key and value.
SELECT
SUM(usage.usage_quantity * list_prices.pricing.effective_list.default)
as `Total Dollar Cost`
FROM system.billing.usage
JOIN system.billing.list_prices ON list_prices.sku_name = usage.sku_name
WHERE usage.custom_tags.{{ tag_key }} = {{ tag_value }}
AND usage.usage_end_time >= list_prices.price_start_time
AND (list_prices.price_end_time IS NULL OR usage.usage_end_time < list_prices.price_end_time)
AND usage.usage_date BETWEEN "2023-05-01" AND "2023-05-31"
View prices that have changed between months
SELECT sku_name, price_start_time, pricing.default
FROM system.billing.list_prices
WHERE price_start_time BETWEEN "2023-05-01" AND "2023-07-01"
Estimate the add-on costs for usage in the previous calendar month
This query applies a simple percentage to all usage in the period. Note that this might differ slightly from the actual monetization due to how entitlements for some add-ons are managed. Replace the add-on rate with your account’s rate.
SELECT SUM(usage.usage_quantity * list_prices.pricing.effective_list.default) * {{ add_on_rate }} as `Total Add-On Dollar Cost`
FROM system.billing.usage
JOIN system.billing.list_prices ON list_prices.sku_name = usage.sku_name
WHERE usage.usage_end_time >= list_prices.price_start_time
AND (list_prices.price_end_time IS NULL OR usage.usage_end_time < list_prices.price_end_time)
AND usage.usage_date BETWEEN "2024-02-01" AND "2024-02-29"