Skip to content

Roll-Up Database Changes & Queries

Roll-up job IDs, the database changes for recurring and non-recurring roll-up jobs with the query details, and the modules to restart.

7 min read Updated SS

Job IDs in the Database#

The following job IDs are defined in the database to differentiate recurring and non-recurring jobs:

DB ID Job Type Trigger Condition
340 Recurring jobs Triggered via a cron expression
341 Non-recurring jobs Triggered without a cron expression

The non-recurring job queries below use 341 as the type_id in scheduler_details.

DB Changes#

Follow the steps below to perform the DB changes.

Recurring Jobs#

To perform the roll-up on the recurring job, enable the following scheduling detail names in the Percona DB and update their status to 1:

  1. Collated KPI 15 min aggregation
  2. Collated KPI 30 min aggregation
  3. Collated KPI 1 hour aggregation
  4. Collated KPI 1 day aggregation

For example:

UPDATE `appsone`.`scheduler_details` SET `status` = '1' WHERE (`name` = 'Collated KPI 15 min aggregation');
UPDATE `appsone`.`scheduler_details` SET `status` = '1' WHERE (`name` = 'Collated KPI 30 min aggregation');
UPDATE `appsone`.`scheduler_details` SET `status` = '1' WHERE (`name` = 'Collated KPI 1 hour aggregation');
UPDATE `appsone`.`scheduler_details` SET `status` = '1' WHERE (`name` = 'Collated KPI 1 day aggregation');

Note: Once the roll-up process is initiated, all data prior to the roll-up start time is treated as non-recurring.

Non-Recurring Jobs#

Note:

  1. The two 15-minute collated jobs must not be triggered simultaneously. This will cause excessive CPU and memory utilization on the OpenSearch service. A minimum gap of 5 minutes must be maintained between them.
  2. Do not set a start time and end time spanning more than 1 week for 15-minute, 30-minute, or 60-minute collations. For a 1440-minute (daily) collation, the maximum selectable start-to-end range is 1 month.
  3. Point 2 applies only when the 1-minute collated index size is less than 10 GB. In this case, 15-minute, 30-minute, and 60-minute collations may be triggered in parallel. If the 1-week index exceeds 10 GB, then for all durations (15-minute, 30-minute, 60-minute, and 1440-minute), the maximum allowed range is 1 week. In this scenario, collations must run sequentially — one after another — and not in parallel, to prevent spikes in CPU and memory utilization.

Query Details#

The following are the query details required to perform the roll-up.

  1. Update the scheduler details query with the date, start time, end time, and status value:

    INSERT INTO appsone.scheduler_details
      (name, type_id, sink_type_id, start_time, end_time, cron_expression,
       created_time, updated_time, user_details_id, account_id, status)
    VALUES
      ('Historical_KPI_Rollup_15mins', 341, 373,
       '<Date Start-Time>', '<Date End-Time>', '',
       NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1', 2, <Status value - 0/1>);
    
  2. Update the scheduler arguments query with the status value:

    INSERT INTO appsone.scheduler_arguments
      (argument_name, argument_value, default_value, is_placeholder,
       scheduler_id, created_time, updated_time, user_details_id)
    VALUES
      ('queue_name', 'job-messages', 'job-messages', 0,
       (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_15mins'),
       NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1');
    
  3. Update the scheduler job details query with the schedule status (Scheduled / Not Started):

    INSERT INTO appsone.scheduler_job_details
      (name, scheduler_id, implementation_id, created_time, updated_time,
       user_details_id, status, job_status)
    VALUES
      ('Historical_KPI_Rollup_15mins',
       (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_15mins'),
       337, NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1', 1, '<NOT STARTED/SCHEDULED>');
    
  4. Update the scheduler job arguments query with the start and end details (<actual date time>, <default date time>):

    INSERT INTO appsone.scheduler_job_arguments
      (argument_name, argument_value, default_value, is_placeholder,
       scheduler_job_id, created_time, updated_time, user_details_id)
    VALUES
      ('source_index_template','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_15mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
      ('target_index_template','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}_15mins','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}_15mins',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_15mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
      ('aggregation_min','15','15',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_15mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
      ('template','heal_collated_kpi','heal_collated_kpi',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_15mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
      ('start_time','<actual date time>','<default date time>',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_15mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
      ('end_time','<actual date time>','<default date time>',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_15mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1');
    
  5. Pass the scheduler action mapping query to secure the mapping for the required action:

    INSERT INTO appsone.scheduler_action_mapping
      (action_id, scheduler_details_id, retry_limit, status,
       created_time, updated_time, user_details_id)
    VALUES
      (342, (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_15mins'),
       3, 1, NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1');
    

To perform the roll-up on the non-recurring job, enable the following scheduling detail names in the Percona DB.

1. For 15 min historic rollup#

INSERT INTO appsone.scheduler_details
  (name, type_id, sink_type_id, start_time, end_time, cron_expression,
   created_time, updated_time, user_details_id, account_id, status)
VALUES
  ('Historical_KPI_Rollup_15mins', 341, 373,
   '2026-03-13 12:00:00', '2026-03-13 12:45:00', '',
   NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1', 2, 0);
INSERT INTO appsone.scheduler_arguments
  (argument_name, argument_value, default_value, is_placeholder,
   scheduler_id, created_time, updated_time, user_details_id)
VALUES
  ('queue_name', 'job-messages', 'job-messages', 0,
   (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_15mins'),
   NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1');
INSERT INTO appsone.scheduler_job_details
  (name, scheduler_id, implementation_id, created_time, updated_time,
   user_details_id, status, job_status)
VALUES
  ('Historical_KPI_Rollup_15mins',
   (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_15mins'),
   337, NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1', 1, 'NOT STARTED');
INSERT INTO appsone.scheduler_job_arguments
  (argument_name, argument_value, default_value, is_placeholder,
   scheduler_job_id, created_time, updated_time, user_details_id)
VALUES
  ('source_index_template','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_15mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('target_index_template','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}_15mins','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}_15mins',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_15mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('aggregation_min','15','15',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_15mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('template','heal_collated_kpi','heal_collated_kpi',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_15mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('start_time','2026-03-09 05:30:00','2026-03-09 05:30:00',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_15mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('end_time','2026-03-13 05:29:59','2026-03-13 05:29:59',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_15mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1');
INSERT INTO appsone.scheduler_action_mapping
  (action_id, scheduler_details_id, retry_limit, status,
   created_time, updated_time, user_details_id)
VALUES
  (342, (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_15mins'),
   3, 1, NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1');

2. For 30 min historic rollup#

INSERT INTO appsone.scheduler_details
  (name, type_id, sink_type_id, start_time, end_time, cron_expression,
   created_time, updated_time, user_details_id, account_id, status)
VALUES
  ('Historical_KPI_Rollup_30mins', 341, 373,
   '2026-03-13 13:00:00', '2026-03-13 13:45:00', '',
   NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1', 2, 0);
INSERT INTO appsone.scheduler_arguments
  (argument_name, argument_value, default_value, is_placeholder,
   scheduler_id, created_time, updated_time, user_details_id)
VALUES
  ('queue_name', 'job-messages', 'job-messages', 0,
   (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_30mins'),
   NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1');
INSERT INTO appsone.scheduler_job_details
  (name, scheduler_id, implementation_id, created_time, updated_time,
   user_details_id, status, job_status)
VALUES
  ('Historical_KPI_Rollup_30mins',
   (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_30mins'),
   337, NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1', 1, 'NOT STARTED');
INSERT INTO appsone.scheduler_job_arguments
  (argument_name, argument_value, default_value, is_placeholder,
   scheduler_job_id, created_time, updated_time, user_details_id)
VALUES
  ('source_index_template','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_30mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('target_index_template','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}_30mins','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}_30mins',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_30mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('aggregation_min','30','30',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_30mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('template','heal_collated_kpi','heal_collated_kpi',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_30mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('start_time','2026-03-09 05:30:00','2026-03-09 05:30:00',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_30mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('end_time','2026-03-13 05:29:59','2026-03-13 05:29:59',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_30mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1');
INSERT INTO appsone.scheduler_action_mapping
  (action_id, scheduler_details_id, retry_limit, status,
   created_time, updated_time, user_details_id)
VALUES
  (342, (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_30mins'),
   3, 1, NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1');

3. For 60 min historic rollup#

INSERT INTO appsone.scheduler_details
  (name, type_id, sink_type_id, start_time, end_time, cron_expression,
   created_time, updated_time, user_details_id, account_id, status)
VALUES
  ('Historical_KPI_Rollup_60mins', 341, 373,
   '2026-03-13 14:00:00', '2026-03-13 14:45:00', '',
   NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1', 2, 0);
INSERT INTO appsone.scheduler_arguments
  (argument_name, argument_value, default_value, is_placeholder,
   scheduler_id, created_time, updated_time, user_details_id)
VALUES
  ('queue_name', 'job-messages', 'job-messages', 0,
   (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_60mins'),
   NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1');
INSERT INTO appsone.scheduler_job_details
  (name, scheduler_id, implementation_id, created_time, updated_time,
   user_details_id, status, job_status)
VALUES
  ('Historical_KPI_Rollup_60mins',
   (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_60mins'),
   337, NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1', 1, 'NOT STARTED');
INSERT INTO appsone.scheduler_job_arguments
  (argument_name, argument_value, default_value, is_placeholder,
   scheduler_job_id, created_time, updated_time, user_details_id)
VALUES
  ('source_index_template','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_60mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('target_index_template','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}_60mins','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}_60mins',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_60mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('aggregation_min','60','60',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_60mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('template','heal_collated_kpi','heal_collated_kpi',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_60mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('start_time','2026-03-09 05:30:00','2026-03-09 05:30:00',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_60mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('end_time','2026-03-13 05:29:59','2026-03-13 05:29:59',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_60mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1');
INSERT INTO appsone.scheduler_action_mapping
  (action_id, scheduler_details_id, retry_limit, status,
   created_time, updated_time, user_details_id)
VALUES
  (342, (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_60mins'),
   3, 1, NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1');

4. For 1440 min historic rollup#

INSERT INTO appsone.scheduler_details
  (name, type_id, sink_type_id, start_time, end_time, cron_expression,
   created_time, updated_time, user_details_id, account_id, status)
VALUES
  ('Historical_KPI_Rollup_1440mins', 341, 373,
   '2026-03-13 15:00:00', '2026-03-13 15:45:00', '',
   NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1', 2, 0);
INSERT INTO appsone.scheduler_arguments
  (argument_name, argument_value, default_value, is_placeholder,
   scheduler_id, created_time, updated_time, user_details_id)
VALUES
  ('queue_name', 'job-messages', 'job-messages', 0,
   (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_1440mins'),
   NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1');
INSERT INTO appsone.scheduler_job_details
  (name, scheduler_id, implementation_id, created_time, updated_time,
   user_details_id, status, job_status)
VALUES
  ('Historical_KPI_Rollup_1440mins',
   (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_1440mins'),
   337, NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1', 1, 'NOT STARTED');
INSERT INTO appsone.scheduler_job_arguments
  (argument_name, argument_value, default_value, is_placeholder,
   scheduler_job_id, created_time, updated_time, user_details_id)
VALUES
  ('source_index_template','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_1440mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('target_index_template','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}_1440mins','heal_collated_kpi_${ACCOUNT_IDENTIFIER}_${YEAR}.w${WEEK_NUMBER}_1440mins',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_1440mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('aggregation_min','1440','1440',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_1440mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('template','heal_collated_kpi','heal_collated_kpi',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_1440mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('start_time','2026-03-09 05:30:00','2026-03-09 05:30:00',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_1440mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1'),
  ('end_time','2026-03-13 05:29:59','2026-03-13 05:29:59',1,(SELECT id FROM scheduler_job_details WHERE name = 'Historical_KPI_Rollup_1440mins'),NOW(),NOW(),'7640123a-fbde-4fe5-9812-581cd1e3a9c1');
INSERT INTO appsone.scheduler_action_mapping
  (action_id, scheduler_details_id, retry_limit, status,
   created_time, updated_time, user_details_id)
VALUES
  (342, (SELECT id FROM appsone.scheduler_details WHERE name = 'Historical_KPI_Rollup_1440mins'),
   3, 1, NOW(), NOW(), '7640123a-fbde-4fe5-9812-581cd1e3a9c1');

Module Restart Requirements#

The following modules must be restarted whenever any modification is made to the Percona DB:

Next