0

If we have a tabled with an indexed fields

create table A (
...
 indexed_field integer
...
);

create index on A(indexed_field);

create or replace function refer_indexed_table(...other_criterion)
    returns table (
     ...
    ) as
$func$
begin
    return query
    select
        *
    from A
    where other_fields match other_criterion;
end
$func$ language plpgsql;

select * from refer_indexed_table(whatever)
where refer_indexed_table.indexed_field = 54;

Would this refer to an indexed_field through the function call still profit from existing index?

1 Answer 1

1

No. That would require the function body to be "inlined" and currently that might happen only with language SQL functions.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.