From: | hubert depesz lubaczewski <depesz(at)depesz(dot)com> |
---|---|
To: | puneet(dot)orcl(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #17189: Index not created when primary key created |
Date: | 2021-09-13 10:36:31 |
Message-ID: | 20210913103631.GB23362@depesz.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Mon, Sep 13, 2021 at 05:27:00AM +0000, PG Bug reporting form wrote:
> I have created the composite primary key which is created successfully but i
> am not getting the index against the primary key.
That's rather impossible. Please show create table statement, and output
of `\d table_name` after creation.
> When i created a select query and includes the primary key column it is
> going with full table scan. Even i am creating an index on the columns it is
> also going with full table scan.
Index will be used only when it makes sense.
If you'd do: select * from table; - that is select all rows - there is
no point in using index, as it will be slower than getting seq scan.
Plus - your table can be too small to effectively use index.
Consider reading:
https://www.depesz.com/2010/09/09/why-is-my-index-not-being-used/
Best regards,
depesz
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2021-09-13 12:27:41 | BUG #17191: Docker / buildx issue - An image created with buildx requires to set custom PGDATA location |
Previous Message | Pavel Stehule | 2021-09-13 09:24:46 | Re: BUG #17189: Index not created when primary key created |