Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.5 kB
2
Indexable
Never
create or replace view workflow_detail_view as
select 
    wv.workflow_id,
    wv.internal_workflow_id,
    wv.engine, 
    -- ... (existing code)

    COALESCE(
        rtrim(ltrim((wv.benchmark_config_jsonb -> 'config'::text) ->> 'engineVersions'::text, '["'::text), '"]'::text),
        (
            SELECT i.engine_internal_version
            FROM instance_v2 i
            INNER JOIN child_workflow_v2 cw ON (i.child_workflow_id = cw.child_workflow_id)
            WHERE wv.workflow_id = cw.workflow_id 
            LIMIT 1
        )
    ) as engineversions,
    -- ... (existing code)

    (wv.benchmark_config_jsonb -> 'logicalreplication'::text) IS NOT NULL AS logicalreplication_enabled,
    COALESCE(substring(wv.internal_workflow_id  FROM '(.*)-' || wv.engine ||  '-.*'), 'none') AS "prefix",
    CASE
        -- ... (existing code)
    END::text as  pz,
    wv.benchmark_config_jsonb -> 'config' ->> 'dbClusterNameSuffix' as db_cluster_name_suffix,
    wv.benchmark_config_jsonb -> 'config' ->> 'pasWorkflowType' as pas_workflow_type,
    COALESCE((wv.benchmark_config_jsonb -> 'config' ->> 'numberOfReaders')::int, 0) as "number_of_readers",

    -- New column: instance_cores
    (CASE WHEN wdv.instance_family = 'serverless'::text THEN GREATEST(wdv.instance_size::integer / 16, 1)
          WHEN wdv.instance_size ~ '\d'::text THEN regexp_replace(wdv.instance_size, '[^\d]'::text, ''::text, 'g'::text)::integer
          ELSE 0 END) * 4 AS instance_cores
from workflow_v2 wv;
Leave a Comment