{"action":"closed","issue":{"url":"https://api.github.com/repos/timescale/timescaledb/issues/643","repository_url":"https://api.github.com/repos/timescale/timescaledb","labels_url":"https://api.github.com/repos/timescale/timescaledb/issues/643/labels{/name}","comments_url":"https://api.github.com/repos/timescale/timescaledb/issues/643/comments","events_url":"https://api.github.com/repos/timescale/timescaledb/issues/643/events","html_url":"https://github.com/timescale/timescaledb/issues/643","id":348064107,"node_id":"MDU6SXNzdWUzNDgwNjQxMDc=","number":643,"title":"Excessive memory usage for large out-of-order INSERTs with partitions.","user":{"login":"JLockerman","id":15097355,"node_id":"MDQ6VXNlcjE1MDk3MzU1","avatar_url":"https://avatars1.githubusercontent.com/u/15097355?v=4","gravatar_id":"","url":"https://api.github.com/users/JLockerman","html_url":"https://github.com/JLockerman","followers_url":"https://api.github.com/users/JLockerman/followers","following_url":"https://api.github.com/users/JLockerman/following{/other_user}","gists_url":"https://api.github.com/users/JLockerman/gists{/gist_id}","starred_url":"https://api.github.com/users/JLockerman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JLockerman/subscriptions","organizations_url":"https://api.github.com/users/JLockerman/orgs","repos_url":"https://api.github.com/users/JLockerman/repos","events_url":"https://api.github.com/users/JLockerman/events{/privacy}","received_events_url":"https://api.github.com/users/JLockerman/received_events","type":"User","site_admin":false},"labels":[{"id":641698708,"node_id":"MDU6TGFiZWw2NDE2OTg3MDg=","url":"https://api.github.com/repos/timescale/timescaledb/labels/limitation","name":"limitation","color":"e99695","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-08-06T20:06:20Z","updated_at":"2018-09-18T14:15:03Z","closed_at":"2018-09-18T14:15:03Z","author_association":"MEMBER","body":"The `INSERT` following code at the end of the following code takes nearly `800MB` of memory:\r\n\r\n```SQL\r\n\r\n-- setup\r\nCREATE TABLE test_ (i bigint, j double precision, k bigint, ts timestamp);\r\nINSERT INTO test_ SELECT random()*101, random()*13, x*10, _timescaledb_internal.to_timestamp(x) FROM generate_series(1,100000000) AS x;\r\nCREATE INDEX ON test_ (ts);\r\n-- possibly create indexs on i, j, and k\r\n\r\nCREATE TABLE test_hyper (i bigint, j double precision, k bigint, ts timestamp);\r\nSELECT create_hypertable('test_hyper', 'i', 'j', 1000, chunk_time_interval=>10);\r\n\r\nINSERT INTO test_hyper SELECT x.i, x.j, x.k, x.ts FROM (select i, j, k, ts from test_ order by ts limit 100000000) as x;\r\n```\r\n\r\nA similar test case partitioning on a custom type\r\n<details>\r\n\r\n```SQL\r\n-- same test_ setup\r\n\r\nCREATE TYPE simpl as (val1);\r\n\r\nCREATE FUNCTION simpl_type_hash(ANYELEMENT) RETURNS INT4\r\nLANGUAGE SQL IMMUTABLE AS $$\r\n    SELECT $1.val1\r\n$$;\r\n\r\nCREATE TABLE simpl_partition (i bigint, object simpl, \"timestamp\" TIMESTAMPTZ);\r\nselect create_hypertable('simpl_partition', 'i', 'object', 1000, chunk_time_interval=>10, partitioning_func=>'simpl_type_hash');\r\n\r\nINSERT INTO simpl_partition SELECT x.i, ROW(x.j)::simpl, x.ts FROM (select i, j, k, ts from test_ order by ts) as x;\r\n```\r\n</details>\r\n\r\ntakes over `4GB` of memory, and did not finish in the time I ran it.\r\n\r\nMemory usage for the former case is independent of #635."}}
{"actor":{"display_login":"JLockerman"}}