{"action":"created","issue":{"url":"https://api.github.com/repos/influxdata/influxdb/issues/6725","repository_url":"https://api.github.com/repos/influxdata/influxdb","labels_url":"https://api.github.com/repos/influxdata/influxdb/issues/6725/labels{/name}","comments_url":"https://api.github.com/repos/influxdata/influxdb/issues/6725/comments","events_url":"https://api.github.com/repos/influxdata/influxdb/issues/6725/events","html_url":"https://github.com/influxdata/influxdb/pull/6725","id":156777581,"number":6725,"title":"Fix pathalogical TSM query case","user":{"login":"jwilder","id":219935,"avatar_url":"https://avatars.githubusercontent.com/u/219935?v=3","gravatar_id":"","url":"https://api.github.com/users/jwilder","html_url":"https://github.com/jwilder","followers_url":"https://api.github.com/users/jwilder/followers","following_url":"https://api.github.com/users/jwilder/following{/other_user}","gists_url":"https://api.github.com/users/jwilder/gists{/gist_id}","starred_url":"https://api.github.com/users/jwilder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwilder/subscriptions","organizations_url":"https://api.github.com/users/jwilder/orgs","repos_url":"https://api.github.com/users/jwilder/repos","events_url":"https://api.github.com/users/jwilder/events{/privacy}","received_events_url":"https://api.github.com/users/jwilder/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/influxdata/influxdb/labels/category/performance","name":"category/performance","color":"006b75"},{"url":"https://api.github.com/repos/influxdata/influxdb/labels/category/queries","name":"category/queries","color":"5319e7"},{"url":"https://api.github.com/repos/influxdata/influxdb/labels/tsm","name":"tsm","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/influxdata/influxdb/milestones/39","html_url":"https://github.com/influxdata/influxdb/milestones/1.0.0","labels_url":"https://api.github.com/repos/influxdata/influxdb/milestones/39/labels","id":1101423,"number":39,"title":"1.0.0","description":"","creator":{"login":"toddboom","id":53132,"avatar_url":"https://avatars.githubusercontent.com/u/53132?v=3","gravatar_id":"","url":"https://api.github.com/users/toddboom","html_url":"https://github.com/toddboom","followers_url":"https://api.github.com/users/toddboom/followers","following_url":"https://api.github.com/users/toddboom/following{/other_user}","gists_url":"https://api.github.com/users/toddboom/gists{/gist_id}","starred_url":"https://api.github.com/users/toddboom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toddboom/subscriptions","organizations_url":"https://api.github.com/users/toddboom/orgs","repos_url":"https://api.github.com/users/toddboom/repos","events_url":"https://api.github.com/users/toddboom/events{/privacy}","received_events_url":"https://api.github.com/users/toddboom/received_events","type":"User","site_admin":false},"open_issues":30,"closed_issues":59,"state":"open","created_at":"2015-05-08T06:30:59Z","updated_at":"2016-05-25T15:19:20Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-05-25T15:19:20Z","updated_at":"2016-05-25T15:33:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/influxdata/influxdb/pulls/6725","html_url":"https://github.com/influxdata/influxdb/pull/6725","diff_url":"https://github.com/influxdata/influxdb/pull/6725.diff","patch_url":"https://github.com/influxdata/influxdb/pull/6725.patch"},"body":"###### Required for all non-trivial PRs\r\n- [ ] Rebased/mergable\r\n- [ ] Tests pass\r\n- [ ] CHANGELOG.md updated\r\n\r\nThis fixes a pathalogical query condition cause by and problematic\r\nstructuring of TSM files based on how points were written.  The\r\ncondition can occur when there are multiple TSM files and a large\r\nnumber of points are written into the past.  The earlier existing\r\nTSM files must also have points in the past and close to the present\r\ncausing their time range to eclipse the later files.\r\n\r\nWhen this condition occurs, some queries can spend an excessive amount\r\nof time merge all the overlapping blocks.\r\n\r\nThe fix was to constrain the window of overlapping blocks based on\r\nthe first one we ran into.  There was also a simple case in the Merge\r\nwhere we could skip the binary search path and just append the two\r\ninputs.\r\n\r\nLocally with a dataset that reproduced the issue.  Query time improvied from **6m53s** **to 4.9s**\r\n### Before\r\n\r\n```bash\r\n$ time influx -database test -execute \"select count(n) from ctr\"\r\nname: ctr\r\n---------\r\ntime\tcount\r\n0\t36550000\r\n\r\n\r\nreal\t6m52.913s\r\nuser\t0m0.004s\r\nsys\t0m0.007s\r\n```\r\n\r\n### After\r\n```bash\r\n$ time influx -database test -execute \"select count(n) from ctr\"\r\nname: ctr\r\n---------\r\ntime\tcount\r\n0\t36550000\r\n\r\n\r\nreal\t0m4.870s\r\nuser\t0m0.004s\r\nsys\t0m0.006s\r\n```\r\n\r\n@benbjohnson "},"comment":{"url":"https://api.github.com/repos/influxdata/influxdb/issues/comments/221614306","html_url":"https://github.com/influxdata/influxdb/pull/6725#issuecomment-221614306","issue_url":"https://api.github.com/repos/influxdata/influxdb/issues/6725","id":221614306,"user":{"login":"benbjohnson","id":118015,"avatar_url":"https://avatars.githubusercontent.com/u/118015?v=3","gravatar_id":"","url":"https://api.github.com/users/benbjohnson","html_url":"https://github.com/benbjohnson","followers_url":"https://api.github.com/users/benbjohnson/followers","following_url":"https://api.github.com/users/benbjohnson/following{/other_user}","gists_url":"https://api.github.com/users/benbjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/benbjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbjohnson/subscriptions","organizations_url":"https://api.github.com/users/benbjohnson/orgs","repos_url":"https://api.github.com/users/benbjohnson/repos","events_url":"https://api.github.com/users/benbjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/benbjohnson/received_events","type":"User","site_admin":false},"created_at":"2016-05-25T15:33:21Z","updated_at":"2016-05-25T15:33:21Z","body":"@jwilder Which part is the actual fix? Most of it seems to be converting to use `tmpl`."}}
{"actor":{"display_login":"benbjohnson"}}