PostgreSQL: Hint

pg_hint_plan

CREATE EXTENSION pg_hint_plan;

SHOW shared_preload_libraries;

You can add this special comment to a query to tell Postgres to do IndexScan on users table by index_users_for_slug index.

/*+ IndexScan(users index_users_for_slug) */

Works in query and FUNCTION.

More at Fixing plans using pg_hint_plan.