Skip to content
This repository has been archived by the owner on May 11, 2020. It is now read-only.

Optimize away redundant temp-group-by's #17

Open
nukep opened this issue Apr 14, 2015 · 0 comments
Open

Optimize away redundant temp-group-by's #17

nukep opened this issue Apr 14, 2015 · 0 comments

Comments

@nukep
Copy link
Owner

nukep commented Apr 14, 2015

SELECT avg(milliseconds) FROM track;

currently compiles into:

(temp-group-by :source_id 1
  (scan `track` :source_id 0
    (yield
      (column-field :source_id 0 :column_offset 0)
      (column-field :source_id 0 :column_offset 1)
      (column-field :source_id 0 :column_offset 2)
      (column-field :source_id 0 :column_offset 3)
      (column-field :source_id 0 :column_offset 4)
      (column-field :source_id 0 :column_offset 5)
      (column-field :source_id 0 :column_offset 6)
      (column-field :source_id 0 :column_offset 7)
      (column-field :source_id 0 :column_offset 8)))
  (group-by-values)
  (yield
    (avg :source_id 1 
      (column-field :source_id 1 :column_offset 6))))

The temp-group-by creates a redundant temporary group, when simply using the table's group could suffice. This could be done with a new scan-group function or similar.

(scan-group `track` :source_id 0
  (yield
    (avg :source_id 0
      (column-field :source_id 0 :column_offset 6))))
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

1 participant