[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pgsql-performance
Subject:    Re: select query does not pick up the right index
From:       Abadie Lana <Lana.Abadie () iter ! org>
Date:       2019-01-09 19:22:45
Message-ID: 9036cbbff60c4fbe978e4a1b825feca0 () iter ! org
[Download RAW message or body]

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@2ndquadrant.com>
Sent: 09 January 2019 17:41:24
To: Abadie Lana
Cc: Justin Pryzby; pgsql-performance@lists.postgresql.org
Subject: Re: select query does not pick up the right index

On Thu, 10 Jan 2019 at 01:55, Abadie Lana <Lana.Abadie@iter.org> 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


[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: \
4pt; border-left: #800000 2px solid; } --></style> </head>
<body>
<div>Oups wrong copy and paste. I did run your query with equal instead of in but it \
resulted in the&nbsp; same plan <hr tabindex="-1" style="display:inline-block; \
width:98%"> <div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" \
color="#000000" style="font-size:11pt"><b>From:</b> David Rowley \
&lt;david.rowley@2ndquadrant.com&gt;<br> <b>Sent:</b> 09 January 2019 17:41:24<br>
<b>To:</b> Abadie Lana<br>
<b>Cc:</b> Justin Pryzby; pgsql-performance@lists.postgresql.org<br>
<b>Subject:</b> Re: select query does not pick up the right index</font>
<div>&nbsp;</div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">On Thu, 10 Jan 2019 at 01:55, Abadie Lana \
&lt;Lana.Abadie@iter.org&gt; wrote:<br> &gt; The other query suggested by D.Rowley \
has the same issue : still swap activity is higher.<br> &gt; 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')&nbsp;&nbsp; order  by c.smpl_time&nbsp; desc \
limit 5;<br> <br>
This is not the query I suggested.&nbsp; I mentioned if channel.name had a<br>
unique index, you'd be able to do WHERE c.channel_id = (select<br>
channel_id from channel where name = '...').&nbsp; That's pretty different<br>
to what you have above.<br>
<br>
-- <br>
&nbsp;David Rowley&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
<a href="http://www.2ndQuadrant.com/">http://www.2ndQuadrant.com/</a><br> \
&nbsp;PostgreSQL Development, 24x7 Support, Training &amp; Services<br> </div>
</span></font>
</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic