Re: Seq scan vs index scan
| От | Christophe Pettus |
|---|---|
| Тема | Re: Seq scan vs index scan |
| Дата | |
| Msg-id | 5FE1E177-BFDB-4386-8DDC-02A652E71C86@thebuild.com обсуждение исходный текст |
| Ответ на | Seq scan vs index scan (arun chirappurath <arunsnmimt@gmail.com>) |
| Список | pgsql-general |
> On Mar 22, 2024, at 20:55, arun chirappurath <arunsnmimt@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
overan index scan if the table is small, or the number of rows that come back from the query are a significant
percentageof 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';
В списке pgsql-general по дате отправления: