Re: limit order by performance issue

From: Marti Raudsepp <marti(at)juffo(dot)org>
To: Pedro Jiménez <p(dot)jimenez(at)ismsolar(dot)com>
Cc: Karl Denninger <karl(at)denninger(dot)net>, pgsql-performance(at)postgresql(dot)org
Subject: Re: limit order by performance issue
Date: 2012-10-16 22:05:39
Message-ID: CABRT9RAKSdwRUE6PrCg6XV=xXi8U2Nyx9Q0YK_ob=yQ2DXuGRw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Oct 16, 2012 at 10:47 PM, Karl Denninger <karl(at)denninger(dot)net> wrote:
> Put an index on time_stamp (I assume there is one on id_signal already)

Well the optimal index for this particular query would include both columns:
(id_signal, time_stamp) -- in this order.

Additionally, if you want to take advantage of the index-only scans
feature, add the SELECTed column too:
(id_signal, time_stamp, var_value)

Regards,
Marti

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Chris Ruprecht 2012-10-16 23:45:48 have: seq scan - want: index scan
Previous Message Merlin Moncure 2012-10-16 20:29:44 Re: LIKE op with B-Tree Index?