Re: select query does not pick up the right index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Oups wrong copy and paste. I did run your query with equal instead of in but it resulted in the  same plan
From: David Rowley <david.rowley@xxxxxxxxxxxxxxx>
Sent: 09 January 2019 17:41:24
To: Abadie Lana
Cc: Justin Pryzby; pgsql-performance@xxxxxxxxxxxxxxxxxxxx
Subject: Re: select query does not pick up the right index
 
On Thu, 10 Jan 2019 at 01:55, Abadie Lana <Lana.Abadie@xxxxxxxx> wrote:
> The other query suggested by D.Rowley has the same issue : still swap activity is higher.
> explain analyze select 'BUIL-B36-VA-RT-RT1:CL0001-2-ABW', c.smpl_time,c.nanosecs,c.float_val,c.num_val,c.str_val,c.datatype,c.array_val from sample c where c.channel_id in (select channel_id from channel where name ='BUIL-B36-VA-RT-RT1:CL0001-2-ABW')   order by c.smpl_time  desc limit 5;

This is not the query I suggested.  I mentioned if channel.name had a
unique index, you'd be able to do WHERE c.channel_id = (select
channel_id from channel where name = '...').  That's pretty different
to what you have above.

--
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux