Re: selectivity function

2022-05-27 Thread Greg Hennessy
On Thu, May 26, 2022 at 3:10 PM Tom Lane wrote: Can you do anything useful with attaching selectivity estimates to the functions it references, instead? I may have been doing down a bad path before. The function I'm working to improve has five argument, the last being "degrees", which is the ma

Re: selectivity function

2022-05-26 Thread Tom Lane
Greg Hennessy writes: > On Thu, May 26, 2022 at 3:10 PM Tom Lane wrote: >> Attaching a support function to a SQL-language function seems pretty >> weird to me. > Is there a way to set the selectivity of a SQL-language function? I think it'd work if you prevented inlining, but doing so would def

Re: selectivity function

2022-05-26 Thread Greg Hennessy
ction? My use case is I'm an astronomer, matching large star catalogs, and if I have a 1e6 star catalog joined with a 1e6 star catalog, the planner estimates about 1e12 rows, even though the selectivity is about 1e-9 or so. Looking at https://www.postgresql.org/docs/current/sql-createfunction.h

Re: selectivity function

2022-05-26 Thread Tom Lane
Greg Hennessy writes: > I'm trying to include a sensitivity operator in a function. My issue is > that when I have my function, I get a call to SupportRequestSimplify, but > not SupportRequestSensitivity. It is not obvious what I am doing that is > incorrect. Attaching a support function to a SQL

selectivity function

2022-05-26 Thread Greg Hennessy
if (IsA(rawreq, SupportRequestSelectivity)) { elog(WARNING,"found SupportRequestSelectivity"); } if (IsA(rawreq, SupportRequestSimplify)) { elog(WARNING,"found SupportRequestSimplify"); } PG_RETURN_POINTER(ret); } my sql function code is: -- a selectivity funct