Skip to content

RPC Function not using index #3715

Discussion options

You must be logged in to vote

Not able to get any indication of index usage for this query

You are not demonstrating that.

The RPC you have is not marked as STABLE and is a plpgsql function. Both prevent function inlining. You can tell from your explain, because there is a "Function Scan" node in it.

This means that inside this "Function Scan" node the function is executed - and the query inside the function is planned and executed separately. You have no information whatsoever in your explain about how that inner query looks like.

Since this is a simple function, which can be expressed as SQL, you might want to rewrite it as such and mark it as STABLE (it is, since it's a plain select only). Then you can try again …

Replies: 1 comment 17 replies

Comment options

You must be logged in to vote
17 replies
@wolfgangwalther
Comment options

@shubham941122
Comment options

@shubham941122
Comment options

@wolfgangwalther
Comment options

@wolfgangwalther
Comment options

Answer selected by wolfgangwalther
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants