pgFouine: PostgreSQL log analysis report
Normalized reports are marked with a "(N)".
- Generated on 2013-11-12 09:27
- Parsed /var/log/postgresql/postgresql-9.1-main.log.bak (1,434 lines) in 1s
- Log from 2013-11-12 09:25:12 to 2013-11-12 09:25:47
Overall statistics ^
- Number of unique normalized queries: 92
- Number of queries: 361 (identified: 360)
- Total query duration: 1.9s (identified: 1.9s)
- First query: 2013-11-12 09:25:12
- Last query: 2013-11-12 09:25:47
- Query peak: 20 queries/s at 2013-11-12 09:25:39
Queries by type ^
Type | Count | Percentage |
---|---|---|
SELECT | 152 | 42.2 |
INSERT | 2 | 0.6 |
Queries that took up the most time (N) ^
Rank | Total duration | Times executed | Av. duration (s) | Query | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 0.5s | 1
|
0.51 | SELECT substring(image FROM 1 FOR 26780) FROM ref.tag_image WHERE pk = 5; |
||||||||
2 | 0.2s | 1
|
0.24 | SELECT DISTINCT ON (pk_identity) * FROM ( SELECT * FROM (( SELECT vbp.*, 'last name'::text AS match_type FROM dem.v_basic_person vbp, dem.names n WHERE vbp.pk_identity = n.id_identity AND lower(n.lastnames) ~* lower('^kirk') ) UNION ALL ( SELECT vbp.*, 'first name'::text AS match_type FROM dem.v_basic_person vbp, dem.names n WHERE vbp.pk_identity = n.id_identity AND lower(n.firstnames) ~* lower('^kirk') ) UNION ALL ( SELECT vbp.*, 'any name part'::text AS match_type FROM dem.v_basic_person vbp, dem.names n WHERE vbp.pk_identity = n.id_identity AND lower(n.firstnames || ' ' || n.lastnames || ' ' || coalesce(n.preferred, '')) ~* lower('kirk') )) AS super_list ORDER BY lastnames, firstnames, dob ) AS sorted_list; |
||||||||
3 | 0.2s | 18
|
0.01 | SELECT * FROM clin.v_pat_encounters c_vpe WHERE c_vpe.pk_patient = 0 ORDER BY started; |
||||||||
4 | 0.2s | 1
|
0.17 | SELECT pk_vaccination, l10n_indication, indication_count FROM clin.v_pat_last_vacc4indication WHERE pk_patient = 12; |
||||||||
5 | 0.1s | 1
|
0.09 | SELECT *, _(role) AS l10n_role FROM dem.v_staff WHERE TRUE ORDER BY can_login DESC, is_active DESC, short_alias ASC; |
||||||||
6 | 0.1s | 1
|
0.08 | SELECT * FROM dem.v_pat_addresses WHERE pk_identity = 12; |
||||||||
7 | 0.1s | 1
|
0.07 | SELECT * FROM clin.get_hints_for_patient(12); |
||||||||
8 | 0.1s | 13
|
0.00 | SELECT * FROM clin.v_pat_episodes WHERE pk_episode=0; |
||||||||
9 | 0.1s | 17
|
0.00 | SELECT DISTINCT fk_encounter FROM clin.clin_root_item WHERE fk_episode IN (...); |
||||||||
10 | 0.0s | 2
|
0.02 | SELECT * FROM dem.v_message_inbox WHERE pk_patient = 0 AND is_overdue IS TRUE ORDER BY due_date, importance DESC, received_when DESC; |
||||||||
11 | 0.0s | 1
|
0.03 | SELECT clin.remove_old_empty_encounters(12::integer, '1 week'::interval); |
||||||||
12 | 0.0s | 135
|
0.00 | ROLLBACK; |
||||||||
13 | 0.0s | 1
|
0.02 | SELECT *, COALESCE ( (SELECT array_agg(seq_idx) FROM blobs.doc_obj b_do WHERE b_do.fk_doc = b_vdm.pk_doc), ARRAY[]::integer[] ) AS seq_idx_list FROM blobs.v_doc_med b_vdm WHERE pk_patient = 12 AND pk_doc IN (SELECT b_vo.pk_doc FROM blobs.v_obj4doc_no_data b_vo WHERE b_vo.pk_patient = 12 AND b_vo.reviewed IS TRUE) ORDER BY clin_when DESC; |
||||||||
14 | 0.0s | 13
|
0.00 | SELECT oid, typname FROM pg_type; |
||||||||
15 | 0.0s | 11
|
0.00 | SELECT *, False AS is_potential_problem FROM clin.v_problem_list WHERE pk_episode = 0 AND pk_patient = 0 AND pk_health_issue IS NULL; |
||||||||
16 | 0.0s | 1
|
0.02 | SELECT * FROM dem.v_message_inbox WHERE pk_patient = 12 ORDER BY due_date NULLS LAST, importance DESC, received_when DESC; |
||||||||
17 | 0.0s | 2
|
0.01 | SELECT * FROM clin.v_pat_episodes WHERE pk_episode IN ( SELECT DISTINCT fk_episode FROM clin.clin_root_item WHERE fk_encounter = 0 UNION SELECT DISTINCT fk_episode FROM blobs.doc_med WHERE fk_encounter = 0 ); |
||||||||
18 | 0.0s | 2
|
0.01 | SELECT * FROM clin.v_pat_encounters WHERE pk_patient = 0 ORDER BY started DESC LIMIT 0; |
||||||||
19 | 0.0s | 2
|
0.01 | INSERT INTO clin.allergy_state ( fk_encounter, has_allergy ) SELECT 0, NULL WHERE NOT EXISTS ( SELECT 0 FROM clin.v_pat_allergy_state WHERE pk_patient = ( SELECT fk_patient FROM clin.encounter WHERE pk = 0 ) ); |
||||||||
20 | 0.0s | 1
|
0.01 | SELECT *, COALESCE ( (SELECT array_agg(seq_idx) FROM blobs.doc_obj b_do WHERE b_do.fk_doc = b_vdm.pk_doc), ARRAY[]::integer[] ) AS seq_idx_list FROM blobs.v_doc_med b_vdm WHERE pk_doc IN ( SELECT DISTINCT ON (b_vo.pk_doc) b_vo.pk_doc FROM blobs.v_obj4doc_no_data b_vo WHERE pk_patient = 12 AND reviewed IS FALSE ) ORDER BY clin_when DESC; |
Slowest queries ^
Rank | Duration (s) | Query |
---|---|---|
1 | 0.51 | SELECT substring(image FROM 1 FOR 26780) FROM ref.tag_image WHERE pk = 5; |
2 | 0.24 | SELECT DISTINCT ON (pk_identity) * FROM ( SELECT * FROM (( SELECT vbp.*, 'last name'::text AS match_type FROM dem.v_basic_person vbp, dem.names n WHERE vbp.pk_identity = n.id_identity AND lower(n.lastnames) ~* lower('^kirk') ) UNION ALL ( SELECT vbp.*, 'first name'::text AS match_type FROM dem.v_basic_person vbp, dem.names n WHERE vbp.pk_identity = n.id_identity AND lower(n.firstnames) ~* lower('^kirk') ) UNION ALL ( SELECT vbp.*, 'any name part'::text AS match_type FROM dem.v_basic_person vbp, dem.names n WHERE vbp.pk_identity = n.id_identity AND lower(n.firstnames || ' ' || n.lastnames || ' ' || coalesce(n.preferred, '')) ~* lower('kirk') )) AS super_list ORDER BY lastnames, firstnames, dob ) AS sorted_list; |
3 | 0.17 | SELECT pk_vaccination, l10n_indication, indication_count FROM clin.v_pat_last_vacc4indication WHERE pk_patient = 12; |
4 | 0.09 | SELECT *, _(role) AS l10n_role FROM dem.v_staff WHERE TRUE ORDER BY can_login DESC, is_active DESC, short_alias ASC; |
5 | 0.08 | SELECT * FROM dem.v_pat_addresses WHERE pk_identity = 12; |
6 | 0.07 | SELECT * FROM clin.get_hints_for_patient(12); |
7 | 0.03 | SELECT clin.remove_old_empty_encounters(12::integer, '1 week'::interval); |
8 | 0.02 | SELECT *, COALESCE ( (SELECT array_agg(seq_idx) FROM blobs.doc_obj b_do WHERE b_do.fk_doc = b_vdm.pk_doc), ARRAY[]::integer[] ) AS seq_idx_list FROM blobs.v_doc_med b_vdm WHERE pk_patient = 12 AND pk_doc IN (SELECT b_vo.pk_doc FROM blobs.v_obj4doc_no_data b_vo WHERE b_vo.pk_patient = 12 AND b_vo.reviewed IS TRUE) ORDER BY clin_when DESC; |
9 | 0.02 | SELECT * FROM dem.v_message_inbox WHERE pk_patient = 12 AND is_overdue IS TRUE ORDER BY due_date, importance DESC, received_when DESC; |
10 | 0.02 | SELECT * FROM dem.v_message_inbox WHERE pk_patient = 12 ORDER BY due_date NULLS LAST, importance DESC, received_when DESC; |
11 | 0.02 | SELECT * FROM dem.v_message_inbox WHERE pk_patient = 12 AND is_overdue IS TRUE ORDER BY due_date, importance DESC, received_when DESC; |
12 | 0.01 | SELECT * FROM clin.v_pat_episodes WHERE pk_episode IN ( SELECT DISTINCT fk_episode FROM clin.clin_root_item WHERE fk_encounter = 1819 UNION SELECT DISTINCT fk_episode FROM blobs.doc_med WHERE fk_encounter = 1819 ); |
13 | 0.01 | SELECT *, COALESCE ( (SELECT array_agg(seq_idx) FROM blobs.doc_obj b_do WHERE b_do.fk_doc = b_vdm.pk_doc), ARRAY[]::integer[] ) AS seq_idx_list FROM blobs.v_doc_med b_vdm WHERE pk_doc IN ( SELECT DISTINCT ON (b_vo.pk_doc) b_vo.pk_doc FROM blobs.v_obj4doc_no_data b_vo WHERE pk_patient = 12 AND reviewed IS FALSE ) ORDER BY clin_when DESC; |
14 | 0.01 | ( SELECT pk_episode AS DATA, description AS field_label, coalesce ( description || ' - ' || health_issue, description ) AS list_label, 1 AS rank FROM clin.v_pat_episodes WHERE episode_open IS true AND description ILIKE '%other documents%' AND pk_patient = 12 ) UNION ALL ( SELECT pk_episode AS DATA, description AS field_label, coalesce ( description || _(' (closed)') || ' - ' || health_issue, description || _(' (closed)') ) AS list_label, 2 AS rank FROM clin.v_pat_episodes WHERE description ILIKE '%other documents%' AND episode_open IS false AND pk_patient = 12 ) ORDER BY rank, list_label LIMIT 30; |
15 | 0.01 | SELECT * FROM clin.v_pat_substance_intake WHERE pk_patient = 12 AND is_currently_active IN (true, NULL) ORDER BY substance; |
16 | 0.01 | SELECT * FROM clin.v_pat_encounters c_vpe WHERE c_vpe.pk_patient = 12 ORDER BY started; |
17 | 0.01 | SELECT * FROM clin.v_pat_encounters c_vpe WHERE c_vpe.pk_patient = 12 ORDER BY started; |
18 | 0.01 | SELECT * FROM clin.v_pat_encounters c_vpe WHERE c_vpe.pk_patient = 12 ORDER BY started; |
19 | 0.01 | SELECT * FROM clin.v_pat_encounters c_vpe WHERE c_vpe.pk_patient = 12 ORDER BY started; |
20 | 0.01 | SELECT * FROM clin.v_pat_encounters c_vpe WHERE c_vpe.pk_patient = 12 ORDER BY started; |
Most frequent queries (N) ^
Rank | Times executed | Total duration | Av. duration (s) | Query | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 135
|
0.0s | 0.00 | ROLLBACK; |
||||||||
2 | 18
|
0.2s | 0.01 | SELECT * FROM clin.v_pat_encounters c_vpe WHERE c_vpe.pk_patient = 0 ORDER BY started; |
||||||||
3 | 18
|
0.0s | 0.00 | COMMIT; |
||||||||
4 | 17
|
0.1s | 0.00 | SELECT DISTINCT fk_encounter FROM clin.clin_root_item WHERE fk_episode IN (...); |
||||||||
5 | 13
|
0.1s | 0.00 | SELECT * FROM clin.v_pat_episodes WHERE pk_episode=0; |
||||||||
6 | 13
|
0.0s | 0.00 | SELECT oid, typname FROM pg_type; |
||||||||
7 | 11
|
0.0s | 0.00 | SELECT *, False AS is_potential_problem FROM clin.v_problem_list WHERE pk_episode = 0 AND pk_patient = 0 AND pk_health_issue IS NULL; |
||||||||
8 | 6
|
0.0s | 0.00 | SET bytea_output TO ''; |
||||||||
9 | 5
|
0.0s | 0.00 | SELECT type FROM cfg.cfg_template WHERE name=''; |
||||||||
10 | 4
|
0.0s | 0.00 | SELECT *, False AS is_potential_problem FROM clin.v_problem_list WHERE pk_episode IS NULL AND pk_patient = 0 AND pk_health_issue = 0; |
||||||||
11 | 4
|
0.0s | 0.00 | SELECT *, xmin_health_issue FROM clin.v_health_issues WHERE pk_health_issue=0; |
||||||||
12 | 4
|
0.0s | 0.00 | SELECT vco.value FROM cfg.v_cfg_opts_string vco WHERE vco.owner = CURRENT_USER AND vco.workplace = '' AND vco.OPTION = '' AND vco.cookie IS NULL LIMIT 0; |
||||||||
13 | 4
|
0.0s | 0.00 | SET timezone TO ''; |
||||||||
14 | 4
|
0.0s | 0.00 | SELECT DISTINCT pk FROM clin.episode WHERE fk_health_issue IN (...); |
||||||||
15 | 4
|
0.0s | 0.00 | SHOW default_transaction_isolation; |
||||||||
16 | 4
|
0.0s | 0.00 | SELECT CURRENT_USER; |
||||||||
17 | 4
|
0.0s | 0.00 | SET session characteristics AS transaction READ WRITE; |
||||||||
18 | 4
|
0.0s | 0.00 | SET default_transaction_isolation TO ''; |
||||||||
19 | 4
|
0.0s | 0.00 | SET default_transaction_read_only TO off; |
||||||||
20 | 2
|
0.0s | 0.02 | SELECT * FROM dem.v_message_inbox WHERE pk_patient = 0 AND is_overdue IS TRUE ORDER BY due_date, importance DESC, received_when DESC; |
Slowest queries (N) ^
Rank | Av. duration (s) | Times executed | Total duration | Query | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 0.51 | 1
|
0.5s | SELECT substring(image FROM 1 FOR 26780) FROM ref.tag_image WHERE pk = 5; |
||||||||
2 | 0.24 | 1
|
0.2s | SELECT DISTINCT ON (pk_identity) * FROM ( SELECT * FROM (( SELECT vbp.*, 'last name'::text AS match_type FROM dem.v_basic_person vbp, dem.names n WHERE vbp.pk_identity = n.id_identity AND lower(n.lastnames) ~* lower('^kirk') ) UNION ALL ( SELECT vbp.*, 'first name'::text AS match_type FROM dem.v_basic_person vbp, dem.names n WHERE vbp.pk_identity = n.id_identity AND lower(n.firstnames) ~* lower('^kirk') ) UNION ALL ( SELECT vbp.*, 'any name part'::text AS match_type FROM dem.v_basic_person vbp, dem.names n WHERE vbp.pk_identity = n.id_identity AND lower(n.firstnames || ' ' || n.lastnames || ' ' || coalesce(n.preferred, '')) ~* lower('kirk') )) AS super_list ORDER BY lastnames, firstnames, dob ) AS sorted_list; |
||||||||
3 | 0.17 | 1
|
0.2s | SELECT pk_vaccination, l10n_indication, indication_count FROM clin.v_pat_last_vacc4indication WHERE pk_patient = 12; |
||||||||
4 | 0.09 | 1
|
0.1s | SELECT *, _(role) AS l10n_role FROM dem.v_staff WHERE TRUE ORDER BY can_login DESC, is_active DESC, short_alias ASC; |
||||||||
5 | 0.08 | 1
|
0.1s | SELECT * FROM dem.v_pat_addresses WHERE pk_identity = 12; |
||||||||
6 | 0.07 | 1
|
0.1s | SELECT * FROM clin.get_hints_for_patient(12); |
||||||||
7 | 0.03 | 1
|
0.0s | SELECT clin.remove_old_empty_encounters(12::integer, '1 week'::interval); |
||||||||
8 | 0.02 | 1
|
0.0s | SELECT *, COALESCE ( (SELECT array_agg(seq_idx) FROM blobs.doc_obj b_do WHERE b_do.fk_doc = b_vdm.pk_doc), ARRAY[]::integer[] ) AS seq_idx_list FROM blobs.v_doc_med b_vdm WHERE pk_patient = 12 AND pk_doc IN (SELECT b_vo.pk_doc FROM blobs.v_obj4doc_no_data b_vo WHERE b_vo.pk_patient = 12 AND b_vo.reviewed IS TRUE) ORDER BY clin_when DESC; |
||||||||
9 | 0.02 | 2
|
0.0s | SELECT * FROM dem.v_message_inbox WHERE pk_patient = 0 AND is_overdue IS TRUE ORDER BY due_date, importance DESC, received_when DESC; |
||||||||
10 | 0.02 | 1
|
0.0s | SELECT * FROM dem.v_message_inbox WHERE pk_patient = 12 ORDER BY due_date NULLS LAST, importance DESC, received_when DESC; |
||||||||
11 | 0.01 | 1
|
0.0s | SELECT *, COALESCE ( (SELECT array_agg(seq_idx) FROM blobs.doc_obj b_do WHERE b_do.fk_doc = b_vdm.pk_doc), ARRAY[]::integer[] ) AS seq_idx_list FROM blobs.v_doc_med b_vdm WHERE pk_doc IN ( SELECT DISTINCT ON (b_vo.pk_doc) b_vo.pk_doc FROM blobs.v_obj4doc_no_data b_vo WHERE pk_patient = 12 AND reviewed IS FALSE ) ORDER BY clin_when DESC; |
||||||||
12 | 0.01 | 1
|
0.0s | ( SELECT pk_episode AS DATA, description AS field_label, coalesce ( description || ' - ' || health_issue, description ) AS list_label, 1 AS rank FROM clin.v_pat_episodes WHERE episode_open IS true AND description ILIKE '%other documents%' AND pk_patient = 12 ) UNION ALL ( SELECT pk_episode AS DATA, description AS field_label, coalesce ( description || _(' (closed)') || ' - ' || health_issue, description || _(' (closed)') ) AS list_label, 2 AS rank FROM clin.v_pat_episodes WHERE description ILIKE '%other documents%' AND episode_open IS false AND pk_patient = 12 ) ORDER BY rank, list_label LIMIT 30; |
||||||||
13 | 0.01 | 1
|
0.0s | SELECT * FROM clin.v_pat_substance_intake WHERE pk_patient = 12 AND is_currently_active IN (true, NULL) ORDER BY substance; |
||||||||
14 | 0.01 | 2
|
0.0s | SELECT * FROM clin.v_pat_episodes WHERE pk_episode IN ( SELECT DISTINCT fk_episode FROM clin.clin_root_item WHERE fk_encounter = 0 UNION SELECT DISTINCT fk_episode FROM blobs.doc_med WHERE fk_encounter = 0 ); |
||||||||
15 | 0.01 | 18
|
0.2s | SELECT * FROM clin.v_pat_encounters c_vpe WHERE c_vpe.pk_patient = 0 ORDER BY started; |
||||||||
16 | 0.01 | 1
|
0.0s | SELECT l10n_type, count(1) AS frequency FROM clin.v_pat_encounters WHERE pk_patient = 12 GROUP BY l10n_type ORDER BY frequency DESC; |
||||||||
17 | 0.01 | 2
|
0.0s | SELECT * FROM clin.v_pat_encounters WHERE pk_patient = 0 ORDER BY started DESC LIMIT 0; |
||||||||
18 | 0.01 | 1
|
0.0s | SELECT * FROM clin.v_test_results WHERE pk_patient = 12 ORDER BY clin_when DESC LIMIT 1; |
||||||||
19 | 0.01 | 1
|
0.0s | SELECT * FROM blobs.v_obj4doc_no_data WHERE pk_obj = 1; |
||||||||
20 | 0.01 | 1
|
0.0s | SELECT * FROM clin.v_test_results WHERE pk_patient = 12 AND reviewed IS FALSE ORDER BY (trim(coalesce(abnormality_indicator), '') <> '') DESC NULLS LAST, unified_abbrev; |