4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Redshiftのキューが詰まり気味かどうか確認する

Posted at

stl_wlm_queryを見れば、クエリがキューに入ってた時間と、実行にかかった時間がわかる。

なので、クエリにかかった総時間のうち、キューに入ってた時間の占める割合が多く、かつ計算リソースがあまり気味な場合、WLMのquery_concurrentyを上げることでクエリのリードタイムを短くできる余地がある。

たとえば以下のようなクエリを投げると、

30sec以上かかったクエリの、キューに入ってた時間と実行にかかった時間、および総時間を、開始時間の降順で300件

が出せる

select 
  r.starttime,
  r.query,
  l.total_queue_time / 1000000.0 as total_queue_time_sec,
  l.total_exec_time / 1000000.0 as total_exec_time_sec,
  (r.endtime - r.starttime) / 1000000.0 as total_time_sec,
  substring(r.querytxt, 0, 100) as query_summary from 
    stl_wlm_query l inner join stl_query r on l.query = r.query 
  where l.total_exec_time > 30000000 order by r.starttime desc limit 300;
        starttime          |  query  | total_queue_time_sec | total_exec_time_sec | total_time_sec |             query_summary
---------------------------+---------+----------------------+---------------------+----------------+------------------------------
2017-05-22 09:59:45.759782 | 1234577 |          33.60106500 |         88.78451400 | 122            | select col1, col2 from ...
2017-05-22 09:59:45.463301 | 1234576 |           0.10747800 |         88.11247500 | 88             | select col1, col2 from ...
2017-05-22 09:59:39.08331  | 1234575 |           3.68974900 |         37.37480700 | 41             | select count(* ...
2017-05-22 09:58:57.252807 | 1234574 |          41.63762000 |         94.75934300 | 136            | select col1, col2 from ...
2017-05-22 09:58:13.491151 | 1234573 |          44.95999800 |         47.11964700 | 92             | select count(* ...
2017-05-22 09:58:07.478298 | 1234572 |           5.92790200 |        125.95480500 | 131            | select col1, col2 from ...
2017-05-22 09:58:07.40917  | 1234571 |           1.22832300 |         48.45053400 | 49             | select count(*...
2017-05-22 09:57:09.519421 | 1234570 |          57.54272200 |        132.29861800 | 189            | select col1, col2 from ...
2017-05-22 09:56:53.672369 | 1234569 |          17.04953400 |         56.55392900 | 73             | select count(* ...
2017-05-22 09:56:34.059251 | 1234568 |          19.30138300 |        168.04979700 | 187            | select col1, col2 from ...
2017-05-22 09:56:20.419248 | 1234567 |          14.83418200 |         34.10228000 | 48             | select count(* ...
...
4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?