> On Mar 22, 2024, at 20:55, arun chirappurath <arunsnm...@gmail.com> wrote:
> I am trying to force query to use indexes using query hints.
PostgreSQL does not have query hints. Enabling index scans using parameters
doesn't *disable* other types of query nodes.
You can disable sequential scans using:
SET enable_seqscan = off;
... but more importantly, why do you want to force an index scan? Generally,
PostgreSQL will pick a sequential scan over an index scan if the table is
small, or the number of rows that come back from the query are a significant
percentage of the rows of the table.
If you would like a more detailed answer, it would be a good idea to post an
execution plan of the query with:
EXPLAIN ANALYZE SELECT * FROM users WHERE username = 'example_username';