{"action":"created","issue":{"url":"https://api.github.com/repos/tempesta-tech/mariadb/issues/314","repository_url":"https://api.github.com/repos/tempesta-tech/mariadb","labels_url":"https://api.github.com/repos/tempesta-tech/mariadb/issues/314/labels{/name}","comments_url":"https://api.github.com/repos/tempesta-tech/mariadb/issues/314/comments","events_url":"https://api.github.com/repos/tempesta-tech/mariadb/issues/314/events","html_url":"https://github.com/tempesta-tech/mariadb/issues/314","id":272545178,"number":314,"title":"TR_table::query() performance","user":{"login":"midenok","id":3307037,"avatar_url":"https://avatars2.githubusercontent.com/u/3307037?v=4","gravatar_id":"","url":"https://api.github.com/users/midenok","html_url":"https://github.com/midenok","followers_url":"https://api.github.com/users/midenok/followers","following_url":"https://api.github.com/users/midenok/following{/other_user}","gists_url":"https://api.github.com/users/midenok/gists{/gist_id}","starred_url":"https://api.github.com/users/midenok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/midenok/subscriptions","organizations_url":"https://api.github.com/users/midenok/orgs","repos_url":"https://api.github.com/users/midenok/repos","events_url":"https://api.github.com/users/midenok/events{/privacy}","received_events_url":"https://api.github.com/users/midenok/received_events","type":"User","site_admin":false},"labels":[{"id":446169241,"url":"https://api.github.com/repos/tempesta-tech/mariadb/labels/info","name":"info","color":"000000","default":false},{"id":388954542,"url":"https://api.github.com/repos/tempesta-tech/mariadb/labels/performance","name":"performance","color":"ffaad0","default":false},{"id":442030504,"url":"https://api.github.com/repos/tempesta-tech/mariadb/labels/task","name":"task","color":"0e8a16","default":false}],"state":"open","locked":false,"assignee":{"login":"midenok","id":3307037,"avatar_url":"https://avatars2.githubusercontent.com/u/3307037?v=4","gravatar_id":"","url":"https://api.github.com/users/midenok","html_url":"https://github.com/midenok","followers_url":"https://api.github.com/users/midenok/followers","following_url":"https://api.github.com/users/midenok/following{/other_user}","gists_url":"https://api.github.com/users/midenok/gists{/gist_id}","starred_url":"https://api.github.com/users/midenok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/midenok/subscriptions","organizations_url":"https://api.github.com/users/midenok/orgs","repos_url":"https://api.github.com/users/midenok/repos","events_url":"https://api.github.com/users/midenok/events{/privacy}","received_events_url":"https://api.github.com/users/midenok/received_events","type":"User","site_admin":false},"assignees":[{"login":"midenok","id":3307037,"avatar_url":"https://avatars2.githubusercontent.com/u/3307037?v=4","gravatar_id":"","url":"https://api.github.com/users/midenok","html_url":"https://github.com/midenok","followers_url":"https://api.github.com/users/midenok/followers","following_url":"https://api.github.com/users/midenok/following{/other_user}","gists_url":"https://api.github.com/users/midenok/gists{/gist_id}","starred_url":"https://api.github.com/users/midenok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/midenok/subscriptions","organizations_url":"https://api.github.com/users/midenok/orgs","repos_url":"https://api.github.com/users/midenok/repos","events_url":"https://api.github.com/users/midenok/events{/privacy}","received_events_url":"https://api.github.com/users/midenok/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/tempesta-tech/mariadb/milestones/17","html_url":"https://github.com/tempesta-tech/mariadb/milestone/17","labels_url":"https://api.github.com/repos/tempesta-tech/mariadb/milestones/17/labels","id":2919746,"number":17,"title":"1.1: First priority tasks after merge","description":"","creator":{"login":"midenok","id":3307037,"avatar_url":"https://avatars2.githubusercontent.com/u/3307037?v=4","gravatar_id":"","url":"https://api.github.com/users/midenok","html_url":"https://github.com/midenok","followers_url":"https://api.github.com/users/midenok/followers","following_url":"https://api.github.com/users/midenok/following{/other_user}","gists_url":"https://api.github.com/users/midenok/gists{/gist_id}","starred_url":"https://api.github.com/users/midenok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/midenok/subscriptions","organizations_url":"https://api.github.com/users/midenok/orgs","repos_url":"https://api.github.com/users/midenok/repos","events_url":"https://api.github.com/users/midenok/events{/privacy}","received_events_url":"https://api.github.com/users/midenok/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":27,"state":"open","created_at":"2017-11-17T13:43:00Z","updated_at":"2018-04-18T18:44:09Z","due_on":null,"closed_at":null},"comments":30,"created_at":"2017-11-09T12:21:41Z","updated_at":"2018-04-19T08:50:15Z","closed_at":null,"author_association":"NONE","body":"1. Make index used (see comments in code).\r\n\r\n2. Also as [commented](https://github.com/tempesta-tech/mariadb/pull/313#pullrequestreview-75387477) on `TR_table::query()`:\r\n> Allocations on every examined row. This memory won't be freed until the query end, right? So such query on a big table will eat too much memory. I don't think this code scales well. We need to create READ_RECORD and surrounding stuff once per query and reuse. Let it be future work. For now I suggest to add a comment or open and issue on that topic.\r\n\r\n### Scripts\r\n* [t2.sql](https://gist.github.com/midenok/22f260f7ba209741b5f35462d098f17b)\r\n* [perf.sql](https://gist.github.com/midenok/021e2c6d05a08aaf8c46b69139e4e992)\r\n\r\n### TODO\r\n- [ ]  `__transaction_registry` derived table must be excluded from wildcard expansion;\r\n- [ ] TRT subquery must be added for each timestamp specifier;\r\n- [ ] TRT subqueries must be removed if they are not used (table is not trx_id-based) or not added at all.\r\n- [ ] Generate TRT subquery name\r\n- [ ] Generate field alias in query `select mysql.transaction_registry.transaction_id as transaction_id`\r\n- [ ] Forced versioning crash test.\r\n"},"comment":{"url":"https://api.github.com/repos/tempesta-tech/mariadb/issues/comments/382659844","html_url":"https://github.com/tempesta-tech/mariadb/issues/314#issuecomment-382659844","issue_url":"https://api.github.com/repos/tempesta-tech/mariadb/issues/314","id":382659844,"user":{"login":"midenok","id":3307037,"avatar_url":"https://avatars2.githubusercontent.com/u/3307037?v=4","gravatar_id":"","url":"https://api.github.com/users/midenok","html_url":"https://github.com/midenok","followers_url":"https://api.github.com/users/midenok/followers","following_url":"https://api.github.com/users/midenok/following{/other_user}","gists_url":"https://api.github.com/users/midenok/gists{/gist_id}","starred_url":"https://api.github.com/users/midenok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/midenok/subscriptions","organizations_url":"https://api.github.com/users/midenok/orgs","repos_url":"https://api.github.com/users/midenok/repos","events_url":"https://api.github.com/users/midenok/events{/privacy}","received_events_url":"https://api.github.com/users/midenok/received_events","type":"User","site_admin":false},"created_at":"2018-04-19T08:50:15Z","updated_at":"2018-04-19T08:50:15Z","author_association":"NONE","body":"## Good: PREPARE\r\n```sql\r\nprepare stmt from \"select i1.x AS x,_trt_subquery.transaction_id AS transaction_id,row_start AS row_start,row_end AS row_end from test.i1 FOR SYSTEM_TIME ALL join (select `mysql`.transaction_registry.transaction_id AS transaction_id from `mysql`.transaction_registry where `mysql`.transaction_registry.commit_timestamp <= TIMESTAMP'2018-04-04 16:40:23' order by `mysql`.transaction_registry.commit_timestamp desc limit 1) _trt_subquery where vtq_trx_sees(i1.row_end,_trt_subquery.transaction_id) and vtq_trx_sees_eq(_trt_subquery.transaction_id,i1.row_start)\";\r\n```"}}
{"actor":{"display_login":"midenok"}}