/Users/iletal/Documents/Dev/create_configs/_data/_acs_configs/acs_suiteapp_bundle_objects.cs
/Users/iletal/Documents/Dev/create_configs/_data/_acs_configs/acs_th_ws.cs


acs_th_ui_e2e_details.json (large)	SRC_ACS_TH_UI_E2E_DETAILS_TB
NJAVATIME_PCTILE\t22 -> 50,95
NSUITESCRIPTTIME_PCTILE\t11 -> 50,95
NHEADERTIME_PCTILE\t23 -> 50,95
NSQLTIME_PCTILE\t13 -> 50,95
NPAGEINITTIME_PCTILE\t19 -> 50,95
NENDTOENDTIME_PCTILE\t2 -> 50,95
NSERVERTIME_PCTILE\t5 -> 50,95
NNONSERVERTIME_PCTILE\t7 -> 50,95
NWORKFLOWTIME_PCTILE\t9 -> 50,95
NPAGELOADTIME_PCTILE\t20 -> 50,95
NNETWORKTIME_PCTILE\t21 -> 50,95
 
acs_th_ui_script_details.json (large)	SRC_ACS_TH_UI_SCRIPT_DETAILS_TB
NTOTALTIME_PCTILE\t3 -> 50,95
NRECORDS_PCTILE\t5 -> 50,95
NREQUESTS_PCTILE\t6 -> 95
NSEARCHES_PCTILE\t7 -> 95
NSQLCALLS_PCTILE\t8 -> 95

acs_th_ui_wf_details.json (medium)	SRC_ACS_TH_UI_WF_DETAILS_TB
NTOTALTIME_PCTILE\t3 -> 50,95

acs_th_ws_concurrency.json (small)	SRC_ACS_TH_WS_CONCURRENCY_TB
NPEAKCONCURRENCY_PCTILE\t6 -> 50,75,95

acs_th_ws_rest.json (small)	SRC_ACS_TH_WS_REST_TB
NEXECUTIONTIME_PCTILE\t2 -> 5,50,95

acs_th_ws_restlets.json (small)	SRC_ACS_TH_WS_RESTLETS_TB
NTOTALTIME_PCTILE\t8 -> 50,95

acs_th_ws_transformed.json (small)	SRC_ACS_TH_WS_TB
NEXECUTIONTIME_PCTILE\t1 -> 5,50,95



drop table SRC_ACS_TH_WS_CONCURRENCY_TEST_TB;

CREATE TABLE SRC_ACS_TH_WS_CONCURRENCY_TEST_TB AS
SELECT * 
FROM SRC_ACS_TH_WS_CONCURRENCY_TB;

UPDATE SRC_ACS_TH_WS_CONCURRENCY_TEST_TB
SET npeakconcurrency_pctile =
       REGEXP_REPLACE(
         REGEXP_REPLACE(
           npeakconcurrency_pctile,
           '\{key=([0-9.]+), value=([0-9.]+)\}',
           '{"key":\1,"value":\2}'
         ),
         '''',
         '"'
       );
       
       
select npeakconcurrency_pctile from SRC_ACS_TH_WS_CONCURRENCY_TEST_TB;

ALTER TABLE SRC_ACS_TH_WS_CONCURRENCY_TEST_TB
ADD CONSTRAINT chk_npeakconcurrency_pctile_json
CHECK (npeakconcurrency_pctile IS JSON);

CREATE SEARCH INDEX idx_conc_pctile_json
ON src_acs_th_ws_concurrency_test_tb (npeakconcurrency_pctile)
FOR JSON;

ALTER TABLE src_acs_th_ws_concurrency_test_tb
ADD npeakconcurrency_pctile_95
  NUMBER
  GENERATED ALWAYS AS (
    JSON_VALUE(
      npeakconcurrency_pctile,
      '$[*]?(@.key == 95).value'
      RETURNING NUMBER
    )
  ) VIRTUAL;
  
SELECT *
FROM src_acs_th_ws_concurrency_test_tb;

select t.*, JSON_VALUE(npeakconcurrency_pctile,
           '$[*]?(@.key == 95).value'
           RETURNING NUMBER) as npeakconcurrency_pctile_95 from src_acs_th_ws_concurrency_test_tb t;



-----

UPDATE SRC_ACS_TH_UI_E2E_DETAILS_TB
SET NJAVATIME_PCTILE =
       REGEXP_REPLACE(
         REGEXP_REPLACE(
           NJAVATIME_PCTILE,
           '\{KEY=([0-9.]+), VALUE=([0-9.]+)\}',
           '{"KEY":\1,"VALUE":\2}'
         ),
         '''',
         '"'
       );

ALTER TABLE SRC_ACS_TH_UI_E2E_DETAILS_TB
ADD CONSTRAINT CHK_NJAVATIME_PCTILE_JSON
CHECK (NJAVATIME_PCTILE IS JSON);

CREATE SEARCH INDEX IDX_NJAVATIME_PCTILE_JSON
ON SRC_ACS_TH_UI_E2E_DETAILS_TB (NJAVATIME_PCTILE)
FOR JSON;