RE: [EXT] Re: Problem getting query to use index inside a function

2025-11-05 Thread Dirschel, Steve
>> Thanks for the reply, but that did not seem to help. > I tried to replicate this as follows: > --- CUT --- > create table request(objectid text, productid int, data jsonb); create index > on request(objectid, productid); > CREATE OR REPLACE FUNCTION public.steve1(param_requestid text[], >

Re: [EXT] Re: Problem getting query to use index inside a function

2025-11-05 Thread Tom Lane
"Dirschel, Steve" writes: >> I think you would have better luck if the planner were "inlining" >> this function, which we can see it's not since you get a Function Scan on >> steve1 rather than the contained query. >> I think the only thing stopping that from happening is that the function is >>

RE: [EXT] Re: Problem getting query to use index inside a function

2025-11-05 Thread Dirschel, Steve
> > Here is the function I'm having difficulties with: > > CREATE OR REPLACE FUNCTION public.steve1(param_requestid text[], > > param_productid integer DEFAULT 1) RETURNS TABLE(objectid text, n > > text, v text, vt integer) LANGUAGE sql AS $function$ > > SELECT objectid::text > >

Re: Problem getting query to use index inside a function

2025-11-05 Thread Tom Lane
"Dirschel, Steve" writes: > Here is the function I'm having difficulties with: > CREATE OR REPLACE FUNCTION public.steve1(param_requestid text[], > param_productid integer DEFAULT 1) > RETURNS TABLE(objectid text, n text, v text, vt integer) > LANGUAGE sql > AS $function$ > SELECT objectid

Problem getting query to use index inside a function

2025-11-05 Thread Dirschel, Steve
I'm not sure if I should send this to pgsql-performance or pqsql-general so hopefully I'm sending to the correct one. Table definition: shared=> \d request Table "public.request" Column |Type | Collation | Nullable | Default