Re: Why my query not doing index only scan

2018-09-10 Thread Laurenz Albe
Arup Rakshit wrote: > I am learning at this point how index works in DBMS. So I am looking for a > very broad explanation to clear my basics. > > I have an index defined "inspector_tool_idx4_1" UNIQUE, btree (company_id, > item_code, deleted_at). > Now I am using the *company_id* column in the w

Re: Why my query not doing index only scan

2018-09-10 Thread Stephen Frost
Greetings, * Arup Rakshit (a...@zeit.io) wrote: > I would like to ask one more question related to this topic. When I take a > dump from production, and restore it to development DB, what are the commands > I generally need to run to dev deb quack close to production? The best way to get a prod

Re: Why my query not doing index only scan

2018-09-10 Thread Arup Rakshit
Hello Stephen, I would like to ask one more question related to this topic. When I take a dump from production, and restore it to development DB, what are the commands I generally need to run to dev deb quack close to production? Thanks, Arup Rakshit a...@zeit.io > On 10-Sep-2018, at 4:58 P

Re: Why my query not doing index only scan

2018-09-10 Thread Arup Rakshit
Thanks Stephen. After running the vacuum on the table it worked. inspection_development=# explain analyze select item_code from inspector_tool_components where company_id = '7881ff2e-0557-4734-9da8-2d33072ff1ef'; QUERY PLA

Re: Why my query not doing index only scan

2018-09-10 Thread Stephen Frost
Greetings, * Arup Rakshit (a...@zeit.io) wrote: > I have an index defined "inspector_tool_idx4_1" UNIQUE, btree (company_id, > item_code, deleted_at). Now I am using the *company_id* column in the where > clause, and the selecting just the *item_code* field for all matching rows. I > expected h