Home | History | Annotate | Download | only in scripts
      1 -- Check Autotest database.
      2 
      3 -- To run: time chromedbread < /tmp/check_db_queries.sql
      4 
      5 -- Y - indicates a table count that will be checked.
      6 
      7 -- AFE Tables
      8 --   | afe_aborted_host_queue_entries            |
      9 -- Y | afe_acl_groups                            |
     10 -- Y | afe_acl_groups_hosts                      |
     11 -- Y | afe_acl_groups_users                      |
     12 --   | afe_atomic_groups                         |
     13 -- Y | afe_autotests                             |
     14 --   | afe_autotests_dependency_labels           |
     15 --   | afe_drone_sets                            |
     16 --   | afe_drone_sets_drones                     |
     17 --   | afe_drones                                |
     18 --   | afe_host_attributes                       |
     19 --   | afe_host_queue_entries                    |
     20 -- Y | afe_hosts                                 |
     21 -- Y | afe_hosts_labels                          |
     22 --   | afe_ineligible_host_queues                |
     23 --   | afe_job_keyvals                           |
     24 -- Y | afe_jobs                                  |
     25 --   | afe_jobs_dependency_labels                |
     26 --   | afe_kernels                               |
     27 -- Y | afe_labels                                |
     28 --   | afe_parameterized_job_parameters          |
     29 --   | afe_parameterized_job_profiler_parameters |
     30 --   | afe_parameterized_jobs                    |
     31 --   | afe_parameterized_jobs_kernels            |
     32 --   | afe_parameterized_jobs_profilers          |
     33 --   | afe_profilers                             |
     34 --   | afe_recurring_run                         |
     35 --   | afe_special_tasks                         |
     36 --   | afe_test_parameters                       |
     37 -- Y | afe_users                                 |
     38 
     39 select count(*) as count_afe_acl_groups from afe_acl_groups;
     40 select count(*) as count_afe_acl_groups_hosts from afe_acl_groups_hosts;
     41 select count(*) as count_afe_acl_groups_users from afe_acl_groups_users;
     42 select count(*) as count_afe_autotests from afe_autotests;
     43 select count(*) as count_afe_hosts from afe_hosts;
     44 select count(*) as count_afe_hosts_labels from afe_hosts_labels;
     45 select count(*) as count_afe_jobs from afe_jobs;
     46 select count(*) as count_afe_labels from afe_labels;
     47 select count(*) as count_afe_users from afe_users;
     48 
     49 -- TKO Tables
     50 --   | tko_embedded_graphing_queries         |
     51 --   | tko_iteration_attributes              |
     52 --   | tko_iteration_result                  |
     53 -- Y | tko_job_keyvals                       |
     54 -- Y | tko_jobs                              |
     55 --   | tko_kernels                           |
     56 -- Y | tko_machines                          |
     57 --   | tko_patches                           |
     58 --   | tko_perf_view                         |
     59 -- Y | tko_perf_view_2                       |
     60 --   | tko_query_history                     |
     61 --   | tko_saved_queries                     |
     62 -- Y | tko_status                            |
     63 -- Y | tko_test_attributes                   |
     64 --   | tko_test_labels                       |
     65 --   | tko_test_labels_tests                 |
     66 --   | tko_test_view                         |
     67 -- Y | tko_test_view_2                       |
     68 --   | tko_test_view_outer_joins             |
     69 -- Y | tko_tests                             |
     70 
     71 select count(*) as count_tko_job_keyvals from tko_job_keyvals;
     72 select count(*) as count_tko_jobs from tko_jobs;
     73 select count(*) as count_tko_machines from tko_machines;
     74 select count(*) as count_tko_perf_view_2 from tko_perf_view_2;
     75 select count(*) as count_tko_status from tko_status;
     76 select count(*) as count_tko_test_attributes from tko_test_attributes;
     77 select count(*) as count_tko_test_view_2 from tko_test_view_2;
     78 select count(*) as count_tko_tests from tko_tests;
     79 
     80 -- Now check for a few details.
     81 
     82 select count(*) as jobs_per_board, left(name,instr(name,'-0')-1) as board from afe_jobs where name like 'x86%' group by board order by board;
     83 select count(*) as platform_count from afe_labels where platform=true;
     84 select `key`, count(*) as job_keyval_count from tko_job_keyvals group by `key`;
     85 select month(queued_time), count(*) as tko_jobs_per_month from tko_jobs group by month(queued_time);
     86 select status, count(*) from tko_test_view_2 group by status;
     87 select left(test_name, 5) as test_name_prefix, count(*) from tko_test_view_2 group by test_name_prefix;
     88 select count(*) as values_per_board, left(job_name,instr(job_name,'-0')-1) as board from tko_perf_view_2 where job_name like 'x86%' group by board order by board;
     89 select left(iteration_key, 5) as key_name_prefix, count(*) from tko_perf_view_2 group by key_name_prefix;
     90