Re: Postgres refusing to use >1 core

From: Aren Cambre <aren(at)arencambre(dot)com>
To: Eric McKeeth <eldin00(at)gmail(dot)com>
Cc: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Postgres refusing to use >1 core
Date: 2011-05-22 03:32:30
Message-ID: BANLkTin_3dVWLaF4-wLEe6nR_xkcyiCHVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Just want to again say thanks for this query. It seriously sped up part of
my program.

Aren

On Thu, May 12, 2011 at 1:27 PM, Aren Cambre <aren(at)arencambre(dot)com> wrote:

> This is a perfect example of a place where you could push some work out of
>> the application and into the database. You can consolidate your 1 to 101
>> queries into a single query. If you use:
>>
>> WHERE rte_nm='SH71' AND rm >= 206 AND rm <= 306 ORDER BY abs(rm - 256), rm
>> - 256 DESC LIMIT 1
>>
>> it will always return the same value as the first matching query from your
>> list, and will never have to make more than one trip to the database. Your
>> one trip might be slightly slower than any one of the single trips above,
>> but it will certainly be much faster in the case where you have to hit any
>> significant % of your 101 potential queries.
>>
>
> THANKS!! I've been obsessing so much about parallelism that I hadn't spent
> much time finding better queries.
>
> Aren
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Leonardo Francalanci 2011-05-22 06:38:20 Re: Performance degradation of inserts when database size grows
Previous Message Lew 2011-05-20 16:47:13 [OT]: Confidentiality disclosures in list posts (Was: SORT performance - slow?)