programm freezes, using an internal formatter

mnk's profile image mnk posted 14 hours ago in General Permalink

When automatically reformatting a request using an internal formatter, the program freezes. This is Ubuntu wine

ansgar's profile image ansgar posted 13 hours ago Permalink

Is it probably a very long query?

Can you post the query here? Take care of sensitive information.

mnk's profile image mnk posted 13 hours ago Permalink

Yes, query is long

SELECT DISTINCT en.type, en.id, en.reg_num, en.id_people, en.id_reg_num, en.profession, en.date_last_visit, en.date_application, en.date_illness, en.mkb10_first, CONCAT(en.mkb10_first," ",mk1.MKB_NAME) AS mkb10_text_first, en.date_of_diagnosis_first, en.date_confirmation_first, CONCAT(rf1.mkb_refind, " ", rf1.mkb_refind_text) as mkb10_refind_first, en.time_all_load, a.polis, en.id_subj, en.mkb10_last, CONCAT(en.mkb10_last," ", mk2.MKB_NAME) AS mkb10_text_last, en.date_of_diagnosis_last, en.date_confirmation_last, CONCAT(rf2.mkb_refind, " ", rf2.mkb_refind_text) as mkb10_refind_last, d1.name_sm as name_hospital, date_hospital, en.poisoning_data, en.dop_info, en.activity, en.cancell, a.surname, a.first_name, a.second_name, CONCAT (a.surname," ",a.first_name, " ",a.second_name) AS fio, a.birthdate, a.sex, a.phone, t.nameas type_text, IF(en.date_hospital is NULL, "амбулат.", "стацион.") as place_text, en.all_load, en.load_rpn, a.fias_live, a.fias_live_house, a.house_live, flat_live, a.address_text_live, t1.name as type_t, IF(DATE_ADD(en.time_reg, INTERVAL 10 DAY) < NOW(), 0, 1) as edit, a.place_work, en.uid, en.date_first_appeal, IF(DATE_ADD(en.time_reg, INTERVAL 70 DAY) < NOW(), 0, 1) as add_dop, d.name_sm as name_lpu, en.cancell, en.labor_exam, en.notes_f60, TIMESTAMPDIFF(MINUTE, IF(en.type_notice = 1, en.date_of_diagnosis_first + INTERVAL 1 DAY, en.date_of_diagnosis_last + INTERVAL 1 DAY), en.timeInsert) AS time_diff, CASE WHEN df.status IS NULL THEN "" ELSE fs.name END AS flu_vakcine, ( (YEAR(CURRENT_DATE) - YEAR(a.birthdate)) - (DATE_FORMAT(CURRENT_DATE, "%m%d") < DATE_FORMAT(a.birthdate, "%m%d")) ) as age, en.timeInsert, en.timeUpdate, dis.id as dispatch_status, m2.last_exist FROM emergency_notice en INNER JOIN people_data a ON (a.id = en.id_people AND a.del=0 and en.del=0) JOIN (SELECT en.id, a.surname, a.first_name, a.second_name, en.timeInsert, if(( SELECT en2.time_all_load FROM emergency_notice en2 WHERE en.reg_num = en2.reg_num ORDER BY en2.time_all_load DESC LIMIT 1) > en.time_all_load, 0,1) AS last_exist FROM emergency_notice en INNER JOIN people_data a ON (a.id = en.id_people AND a.del=0) INNER JOIN dic_lpu d ON (en.id_subj = d.id_subj) WHERE en.del=0 and a.del=0 AND en.id_subj =888 ORDER BY en.timeInsert DESC LIMIT 20 OFFSET 0) m2 ON (en.id = m2.id) LEFT JOINlogl0 ON (en.id = l0.id_tabl and l0.tabl="emergency_notice" and l0.action=2) LEFT JOINlogl1 ON (a.id = l1.id_tabl and l1.tabl="people_data" and l1.action=2) LEFT JOIN dic_lpu d ON (en.id_subj = d.id_subj) LEFT JOIN dic_lpu d1 ON (en.id_subj_hospital = d1.id_subj) LEFT JOIN nci.mkb10 mk1 ON (en.mkb10_first = mk1.MKB_CODE) LEFT JOIN nci.mkb10 mk2 ON (en.mkb10_last = mk2.MKB_CODE) LEFT JOIN dictionarys t ON (en.type = t.cod AND t.dictionary = 29 AND t.islast = 1) LEFT JOIN dictionarys t1 ON (en.type_notice = t1.cod AND t1.dictionary = 33 AND t1.islast = 1) LEFT JOIN fias_cov.rpn_refind_ds rf1 ON (en.mkb10_refind_first = rf1.guid) LEFT JOIN fias_cov.rpn_refind_ds rf2 ON (en.mkb10_refind_last = rf2.guid) LEFT JOIN data_flu df ON (a.id = df.id_people AND df.del = 0) LEFT join dictionarys fs ON (df.status = fs.cod and fs.islast = 1 AND fs.dictionary=41) LEFT join dispatch dis on (en.id = dis.id_en) ORDER BY en.timeInsert DESC

mnk's profile image mnk posted 13 hours ago Permalink

Even with this request it hangs

SELECT * FROM patient a WHERE a.Person_id=1657664

ansgar's profile image ansgar posted 13 hours ago Permalink

Confirmed. Will have a look at that.

Please login to leave a reply, or register at first.