Re: SLOPE - Planner optimizations on monotonic expressions.

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Alexandre Felipe <o(dot)alexandre(dot)felipe(at)gmail(dot)com>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: SLOPE - Planner optimizations on monotonic expressions.
Date: 2026-04-06 23:09:33
Message-ID: CAN4CZFMDq-FMwLQitgAZOWW98R__Ajqy5EzJt3cBLMNtohJQnw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I think there's a bug with NULL handling:

CREATE TABLE slope_nulls_test (v int4);
INSERT INTO slope_nulls_test SELECT generate_series(1, 10);
INSERT INTO slope_nulls_test VALUES (NULL), (NULL);
CREATE INDEX slope_nulls_idx ON slope_nulls_test (v ASC NULLS FIRST);
ANALYZE slope_nulls_test;

SET enable_seqscan = off;

SELECT floor(v::float8), v FROM slope_nulls_test ORDER BY 1;

RESET enable_seqscan;
SET enable_indexscan = off;
SELECT floor(v::float8), v FROM slope_nulls_test ORDER BY 1;

{ oid => '2308', descr => 'nearest integer >= value',
- proname => 'ceil', prorettype => 'float8', proargtypes => 'float8',
- prosrc => 'dceil' },
+ proname => 'ceil', prosupport => 'arg0_asc_slope_support',
+ prorettype => 'float8', proargtypes => 'float8', prosrc => 'dceil' },
{ oid => '2320', descr => 'nearest integer >= value',
proname => 'ceiling', prorettype => 'float8', proargtypes => 'float8',
prosrc => 'dceil' },

Shouldn't 2320 also have the same change? Same for 1711/2167

{ oid => '183',
- proname => 'int42mi', prorettype => 'int4', proargtypes => 'int4 int2',
- prosrc => 'int42mi' },
+ proname => 'int42mi', prosupport => 'diff_slope_support',
+ prorettype => 'int4', proargtypes => 'int4 int2', prosrc => 'int42mi' },

Similarly shouldn't int24/int42 mul and div also be included?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haibo Yan 2026-04-06 23:32:02 Re: Implement missing join selectivity estimation for range types
Previous Message Sami Imseih 2026-04-06 22:56:21 Return DSA area for hash table from GetNamedDSHash()