You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- THIS SCRIPT IS AUTOMATICALLY GENERATED. DO NOT EDIT IT DIRECTLY.
DROP TABLE IF EXISTS icustay_times; CREATE TABLE icustay_times AS
-- create a table which has fuzzy boundaries on hospital admission
-- involves first creating a lag/lead version of disch/admit time
-- get first/last heart rate measurement during hospitalization for each stay_id
WITH t1 AS (
SELECT ce.stay_id
, MIN(charttime) AS intime_hr
, MAX(charttime) AS outtime_hr
FROM mimiciv_icu.chartevents ce
-- only look at heart rate
WHERE ce.itemid = 220045 GROUP BY ce.stay_id
)
-- add in subject_id/hadm_id
SELECT
ie.subject_id, ie.hadm_id, ie.stay_id
, t1.intime_hr
, t1.outtime_hr
FROM mimiciv_icu.icustays ie
LEFT JOIN t1
ON ie.stay_id = t1.stay_id;
经过分析是group by导致查询过慢,请问该如何优化或者怎么样做才能导入成功
After analysis, the execution is too slow due to group by, how to optimize or how to import successfully?
The text was updated successfully, but these errors were encountered:
Prerequisites
Description
Description of the issue, including:
I'm doing icustay_times.sql in a postgres database
\i icustay_times.sql
我在导入icustay_times.sql时出现一个报错
[SQL] Query icustay_times start
[ERR] 错误: 由于语句执行超时,正在取消查询命令
-- THIS SCRIPT IS AUTOMATICALLY GENERATED. DO NOT EDIT IT DIRECTLY.
DROP TABLE IF EXISTS icustay_times; CREATE TABLE icustay_times AS
-- create a table which has fuzzy boundaries on hospital admission
-- involves first creating a lag/lead version of disch/admit time
-- get first/last heart rate measurement during hospitalization for each stay_id
WITH t1 AS (
SELECT ce.stay_id
, MIN(charttime) AS intime_hr
, MAX(charttime) AS outtime_hr
FROM mimiciv_icu.chartevents ce
-- only look at heart rate
WHERE ce.itemid = 220045
GROUP BY ce.stay_id
)
-- add in subject_id/hadm_id
SELECT
ie.subject_id, ie.hadm_id, ie.stay_id
, t1.intime_hr
, t1.outtime_hr
FROM mimiciv_icu.icustays ie
LEFT JOIN t1
ON ie.stay_id = t1.stay_id;
经过分析是group by导致查询过慢,请问该如何优化或者怎么样做才能导入成功
After analysis, the execution is too slow due to group by, how to optimize or how to import successfully?
The text was updated successfully, but these errors were encountered: