SLOPE - Planner optimizations on monotonic expressions.

Started by Alexandre Felipe23 days ago2 messages
Jump to latest
#1Alexandre Felipe
o.alexandre.felipe@gmail.com

Motivation:
Consider a table data with an indexed timestamp column ts,
the query `SELECT ts::date, count(1) GROUP BY 1;` requires
ts::date to be sorted, but the planner is not aware of the fact
that ts::date will ordered whenever ts is ordered.

This includes slope information to several builtin functions.
type casting, addition, subtraction, common mathematical functions,
e.g. atan, sinh, log, exp, erf, etc. And some date manipulation function.
This may not be complete, but already covers obvious cases.

e.g. SELECT created_at::date, count(1) FROM tasks GROUP BY 1;

can use an index on created_at, to count tasks per day.

You can find examples of howthis feature can be useful in the test file,
including
- Ordered outputs without a sorting node.
- GroupAggregate used directly on the index scan
- MinMaxAggregate replaced by Index scan + limit.

Attachments:

0002-SLOPE-Builtin-support.patchapplication/octet-stream; name=0002-SLOPE-Builtin-support.patchDownload+396-215
0003-SLOPE-Tests.patchapplication/octet-stream; name=0003-SLOPE-Tests.patchDownload+703-3
0001-SLOPE-Analysis-Machinery.patchapplication/octet-stream; name=0001-SLOPE-Analysis-Machinery.patchDownload+367-8
#2Alexandre Felipe
o.alexandre.felipe@gmail.com
In reply to: Alexandre Felipe (#1)
Re: SLOPE - Planner optimizations on monotonic expressions.

Hi Hackers,

Is there anything else I can do to move this forward?
Anyone could review review? This one should be a quick review!

Regards,
Alexandre