SLOPE - Planner optimizations on monotonic expressions. - Mailing list pgsql-hackers

From Alexandre Felipe
Subject SLOPE - Planner optimizations on monotonic expressions.
Date
Msg-id CAE8JnxN8kLUMygXb33LC-UPGyTC0cTcCyeWUdfEoz=OBo3aT5g@mail.gmail.com
Whole thread
Responses Re: SLOPE - Planner optimizations on monotonic expressions.
Re: SLOPE - Planner optimizations on monotonic expressions.
List pgsql-hackers
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.


Attachment

pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: pg_upgrade: transfer pg_largeobject_metadata's files when possible
Next
From: Thomas Munro
Date:
Subject: Re: Regression failures after changing PostgreSQL blocksize