Few examples of creating indexes and use it by sqlite internally
--select * from trial_run_setting where trial_master_id = -1 order by trial_run_setting_id desc limit 1;
--select trs.*, um.username from trial_run_setting trs left join user_master um on um.user_id = trs.user_id where trial_run_setting_id = 573;
--select * from target_step_setting where trial_run_setting_id = 573;
--select * from manual_filter_details where trial_run_setting_id =577;
--select width, height, no_of_channel, surface_area, ecs from cassette_lookup where part_no = 'PP030WP1H';
--select trs.*, um.username from trial_run_setting trs left join user_master um on um.user_id = trs.user_id where trial_run_setting_id = 577;
/*1675266607000
1675266408000*/
select endTime,startTime from (select timestamp*1000 as endTime from trial_hist_data where trial_run_setting_id = 577
order by trial_live_data_id desc limit 1), (select timestamp*1000 as startTime from trial_hist_data
where trial_run_setting_id = 577 order by trial_live_data_id asc limit 1);
select timestamp*1000 from trial_hist_data where trial_run_setting_id = 577
order by trial_live_data_id desc limit 1;
select trial_live_data_id,timestamp*1000 from trial_hist_data where trial_run_setting_id = 577
order by trial_live_data_id asc limit 1;
select * from trial_hist_data limit 99999999;
CREATE INDEX tldi_title ON trial_hist_data (trial_live_data_id);
SQLite database optimization using indexes
Please refer the Link
Few examples of creating indexes and use it by sqlite internally