Search Postgresql Archives

Re: Seq scan vs index scan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Mar 22, 2024, at 20:55, arun chirappurath <arunsnmimt@xxxxxxxxx> 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';





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux