Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pls why did the import icustay_times fail? #1837

Open
1 task
lemonltea opened this issue Dec 14, 2024 · 0 comments
Open
1 task

Pls why did the import icustay_times fail? #1837

lemonltea opened this issue Dec 14, 2024 · 0 comments

Comments

@lemonltea
Copy link

Prerequisites

Description

Description of the issue, including:

  • what you have tried
  • references to similar issues
  • queries demonstrating your question (if applicable)

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant