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

(JP) char型のカラムをORDER BYに指定すると、gpusort.c内で大量の共有メモリを確保してメモリ不足に陥る #41

Closed
taiki-k opened this issue Jun 20, 2014 · 2 comments
Labels
bug developer confirmed the steps to reproduce the problem, and does not work as expected

Comments

@taiki-k
Copy link
Contributor

taiki-k commented Jun 20, 2014

最新のコードで、char型のカラムをORDER BYに指定したSQLを実行したところ、
メモリ不足で実行が中断されました。

  • 実行したSQL文
SELECT * FROM clock_md5 WHERE id BETWEEN 100 AND 200 ORDER BY time_md5;
  • 対象のテーブル
     テーブル "public.clock_md5"
    列    |      型       |  修飾語
----------+---------------+----------
 id       | integer       | not null
 time_md5 | character(32) | not null

  • クエリープラン
INFO:  now ready to run bulk-load
                                   QUERY PLAN
--------------------------------------------------------------------------------
 Custom (GpuSort)  (cost=94833.99..94833.99 rows=1 width=37)
   Sort keys: time_md5
   Sort keys width: 140
   Rows per chunk: 32
   ->  Custom (GpuScan) on clock_md5  (cost=10000.00..94833.99 rows=1 width=37)
         Host References: id, time_md5
         Device References: id
         Device Filter: ((id >= 100) AND (id <= 200))
 Planning time: 0.976 ms
(9 行)
  • クエリープラン (pg_strom.enabled = OFF時)
                             QUERY PLAN
---------------------------------------------------------------------
 Sort  (cost=233332.93..233332.93 rows=1 width=37)
   Sort Key: time_md5
   ->  Seq Scan on clock_md5  (cost=0.00..233332.92 rows=1 width=37)
         Filter: ((id >= 100) AND (id <= 200))
 Planning time: 0.145 ms
(5 行)
@kaigai
Copy link
Contributor

kaigai commented Jun 20, 2014

pg_strom.enabled = off; 時のexplainにあるように、統計情報が間違っている (rows=1) 場合に
バッファの量を過少に見積もってしまうのが原因ですね。

ただ、統計情報は常に間違っている可能性があるので、統計情報がおかしい時にどういう挙動をさせる
べきかは検討しておかねばいけません。対策を考え中。。。

@kaigai
Copy link
Contributor

kaigai commented Oct 27, 2014

コードベースが非常に古いので、一旦クローズ扱いとします。

@kaigai kaigai closed this as completed Oct 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug developer confirmed the steps to reproduce the problem, and does not work as expected
Projects
None yet
Development

No branches or pull requests

2 participants