Project

General

Profile

action #94667

Updated by livdywan over 1 year ago

## Motivation 

 The SQL to fetch the data is inefficient. For each item in the result set another `SELECT FROM job_settings` is executed. For https://openqa.suse.de/admin/test_suites that means about 2500 SELECTs currently. 
 Also the costly DateTime columns are fetched, although they are not needed. 

 ## Acceptance criteria 

 * **AC1**: Significant performance improvements 

 ## Suggestions 
 * The AC1: the number of individual SQL queries doesn't go up with depend on the number of items in the table anymore 
 * AC2: Less columns are fetched 
 

 ## Suggestions 

 * All three `/api/v1/products`, `/api/v1/machines`, `/api/v1/test_suites` are handled by the same code in `lib/OpenQA/WebAPI/Controller/API/V1/Table.pm` 
 * Enable `DBIC_TRACE=1` environment variable to see all SQL 
 * https://github.com/os-autoinst/openQA/pull/3969 has a similar optimizations 
 * Look at the existing patch from #94667#note-7 This could be a good task for someone not so familiar with DBIx::Class yet

Back