Re: Why my query not using index to sort?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Arup Rakshit <ar(at)zeit(dot)io>, Ravi Krishna <srkrishna1(at)aol(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why my query not using index to sort?
Date: 2018-09-28 13:29:48
Message-ID: e8f8d7d8-044b-829f-a063-cb79f6e11d2b@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9/28/18 6:19 AM, Arup Rakshit wrote:
> Hi Ravi,
>
>
> Yes you are right. It seems it is doing sorting in memory by name. But I
> have `name` column in index.

You are looking for the vessels.company_id not vessels.name so not sure
why you expect an index lookup on name?

>
>
> Thanks,
>
> Arup Rakshit
> ar(at)zeit(dot)io <mailto:ar(at)zeit(dot)io>
>
>
>
>> On 28-Sep-2018, at 6:38 PM, Ravi Krishna <srkrishna1(at)aol(dot)com
>> <mailto:srkrishna1(at)aol(dot)com>> wrote:
>>
>>
>>> Is there anyway, I can improve the sorting so that it can use the index ?
>>
>> Are you telling that why PG is not simply reading the data from the
>> index (which is already in sorted
>> order)?
>>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2018-09-28 13:31:46 Re: How to maintain the csv log files in pg_log directory only for past 30 days
Previous Message Francisco Olarte 2018-09-28 13:28:23 Re: How to maintain the csv log files in pg_log directory only for past 30 days