WITH inputs AS (
SELECT
50000::numeric AS target_ops_per_sec,
300::numeric AS ops_per_sec_per_core,
25::numeric AS extra_capacity_pct,
32 AS cores_per_node
),
sizing AS (
SELECT
*,
target_ops_per_sec * (1 + extra_capacity_pct / 100)
/ ops_per_sec_per_core AS raw_core_estimate
FROM inputs
)
SELECT
round(raw_core_estimate, 2) AS calculated_cores,
ceil(raw_core_estimate)::integer AS minimum_whole_cores,
ceil(raw_core_estimate / cores_per_node)::integer AS nodes,
ceil(raw_core_estimate / cores_per_node)::integer
* cores_per_node AS provisioned_cores
FROM sizing;