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

List:       pgsql-performance
Subject:    Re: [PERFORM] how to change the provoke table in hash join
From:       "Huang, Suya" <Suya.Huang () au ! experian ! com>
Date:       2014-09-12 3:33:42
Message-ID: D83E55F5F4D99B4A9B4C4E259E6227CD01EBF090 () AUX1EXC02 ! apac ! experian ! local
[Download RAW message or body]

[Attachment #2 (text/plain)]

From: Jeff Janes [mailto:jeff.janes@gmail.com]
Sent: Friday, September 12, 2014 4:09 AM
To: Matheus de Oliveira
Cc: Huang, Suya; pgsql-performance@postgresql.org
Subject: Re: [PERFORM] how to change the provoke table in hash join


On Thu, Sep 11, 2014 at 7:09 AM, Matheus de Oliveira \
<matioli.matheus@gmail.com<mailto:matioli.matheus@gmail.com>> wrote:

On Wed, Sep 10, 2014 at 10:05 PM, Huang, Suya \
                <Suya.Huang@au.experian.com<mailto:Suya.Huang@au.experian.com>> \
                wrote:
--plan 1, 10 seconds were spent on sequential scan on term_weekly table.

dev=# explain analyze select distinct  cs_id from lookup_weekly  n inner join \
term_weekly s on s.b_id=n.b_id and s.date=n.date where term in ('cat'::text);


                                                                           QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
 HashAggregate  (cost=2100211.06..2100211.11 rows=5 width=4) (actual \
                time=27095.470..27095.487 rows=138 loops=1)
...

--plan 2, only 1 second spent on index scan of term_weekly table, however, as it \
selects the big table to do the hashing, it takes 22 seconds for the hash to \
complete. The advantage get from index has been totally lost because of this join \
order.

                                                                                      \
                QUERY PLAN
-------------------------------------------------------------------------------------- \
-----------------------------------------------------------------------------------------------------
 HashAggregate  (cost=1429795.17..1429795.22 rows=5 width=4) (actual \
                time=22991.289..22991.307 rows=138 loops=1)
...

Am I reading something wrong here? I haven't looked all the plan, but the second is \
faster (overall), so why do you think you need a hint or change what the planner \
choose? For me looks like using the index is the best for this situation. Could you \
try running this multiple times and taking the min/max/avg time of both?

The difference in time could be a caching effect, not a reproducible difference.

The 2nd plan uses 3GB of memory, and there might be better uses for that memory.

Currently memory is un-costed, other than "cliff costing" once you thinks it will \
exceed work_mem, which I think is a problem.  Just because I will let you use 4GB of \
memory if you will really benefit from it, doesn't mean you should use 4GB \
gratuitously.


Suya, what happens if you lower work_mem setting?  Does it revert to the plan you \
want?

Cheers,

Jeff

________________________________

Hey Jeff,

It's quite interesting, after I reduced the work_mem to 1GB, it chose the right plan. \
Also, if I create a temporary table and then join it with the temporary table, it \
also chose the right plan. Is this a defect of PG optimizer? While doing hash join, \
it's unable to pick the small table to be the hash probe table while the query is \
complicated (not really that complicated in this case)

                                                                                      \
                QUERY PLAN
-------------------------------------------------------------------------------------- \
-----------------------------------------------------------------------------------------------------------
 HashAggregate  (cost=1524294.96..1524295.01 rows=5 width=4) (actual \
                time=13409.960..13409.979 rows=138 loops=1)
   ->  Hash Join  (cost=143.25..1524294.94 rows=5 width=4) (actual \
                time=10648.440..13409.718 rows=160 loops=1)
         Hash Cond: (((n.b_id)::text = (s.b_id)::text) AND (n.date = s.date))
         ->  Append  (cost=0.00..862153.59 rows=37828460 width=52) (actual \
                time=0.006..8152.938 rows=37828459 loops=1)
               ->  Seq Scan on lookup_weekly n  (cost=0.00..0.00 rows=1 width=524) \
                (actual time=0.000..0.000 rows=0 loops=1)
               ->  Seq Scan on lookup_weekly_20131130 n_1  (cost=0.00..117764.18 \
                rows=5158718 width=52) (actual time=0.006..743.985 rows=5158718 \
                loops=1)
               ->  Seq Scan on lookup_weekly_20131207 n_2  (cost=0.00..117764.18 \
                rows=5158718 width=52) (actual time=0.003..894.061 rows=5158718 \
                loops=1)
               ->  Seq Scan on lookup_weekly_20131214 n_3  (cost=0.00..117764.18 \
                rows=5158718 width=52) (actual time=0.008..746.660 rows=5158718 \
                loops=1)
               ->  Seq Scan on lookup_weekly_20131221 n_4  (cost=0.00..117764.18 \
                rows=5158718 width=52) (actual time=0.004..750.305 rows=5158718 \
                loops=1)
               ->  Seq Scan on lookup_weekly_20131228 n_5  (cost=0.00..117764.18 \
                rows=5158718 width=52) (actual time=0.004..741.233 rows=5158718 \
                loops=1)
               ->  Seq Scan on lookup_weekly_20140426 n_6  (cost=0.00..91715.42 \
                rows=4042442 width=52) (actual time=0.010..595.792 rows=4042442 \
                loops=1)
               ->  Seq Scan on lookup_weekly_20140503 n_7  (cost=0.00..93516.49 \
                rows=4118149 width=52) (actual time=0.009..598.208 rows=4118149 \
                loops=1)
               ->  Seq Scan on lookup_weekly_20140329 n_8  (cost=0.00..88100.78 \
                rows=3874278 width=52) (actual time=0.004..574.846 rows=3874278 \
                loops=1)
         ->  Hash  (cost=142.77..142.77 rows=32 width=61) (actual time=0.924..0.924 \
rows=553 loops=1)  Buckets: 1024  Batches: 1  Memory Usage: 43kB
               ->  Append  (cost=0.00..142.77 rows=32 width=61) (actual \
                time=0.031..0.752 rows=553 loops=1)
                     ->  Seq Scan on term_weekly s  (cost=0.00..0.00 rows=1 \
width=520) (actual time=0.000..0.000 rows=0 loops=1)  Filter: (term = 'cat'::text)
                     ->  Index Scan using idx_term_weekly_20140503_3 on \
term_weekly_20140503 s_1  (cost=0.56..36.70 rows=8 width=46) (actual \
time=0.031..0.225 rows=166 loops=1)  Index Cond: (term = 'cat'::text)
                     ->  Index Scan using idx_term_weekly_20140510_3 on \
term_weekly_20140510 s_2  (cost=0.56..36.70 rows=8 width=46) (actual \
time=0.023..0.192 rows=152 loops=1)  Index Cond: (term = 'cat'::text)
                     ->  Index Scan using idx_term_weekly_20140517_3 on \
term_weekly_20140517 s_3  (cost=0.56..36.70 rows=8 width=46) (actual \
time=0.022..0.176 rows=135 loops=1)  Index Cond: (term = 'cat'::text)
                     ->  Index Scan using idx_term_weekly_20140524_3 on \
term_weekly_20140524 s_4  (cost=0.56..32.68 rows=7 width=46) (actual \
time=0.016..0.126 rows=100 loops=1)  Index Cond: (term = 'cat'::text)
Total runtime: 13410.097 ms

Thanks,
Suya


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
	{font-family:宋体;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:"\@宋体";
	panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri","sans-serif";}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><b><span \
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span \
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Jeff \
Janes [mailto:jeff.janes@gmail.com] <br>
<b>Sent:</b> Friday, September 12, 2014 4:09 AM<br>
<b>To:</b> Matheus de Oliveira<br>
<b>Cc:</b> Huang, Suya; pgsql-performance@postgresql.org<br>
<b>Subject:</b> Re: [PERFORM] how to change the provoke table in hash \
join<o:p></o:p></span></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">On Thu, Sep 11, 2014 at 7:09 AM, Matheus de Oliveira &lt;<a \
href="mailto:matioli.matheus@gmail.com" \
target="_blank">matioli.matheus@gmail.com</a>&gt; wrote:<o:p></o:p></p> <div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">On Wed, Sep 10, 2014 at 10:05 PM, Huang, Suya &lt;<a \
href="mailto:Suya.Huang@au.experian.com" \
target="_blank">Suya.Huang@au.experian.com</a>&gt; wrote:<o:p></o:p></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">--plan \
1, 10 seconds were spent on sequential scan on term_weekly table.<o:p></o:p></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></o:p></p>
 <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">dev=# explain analyze \
select distinct&nbsp; cs_id from lookup_weekly&nbsp; n inner join term_weekly s on \
s.b_id=n.b_id and s.date=n.date where term in ('cat'::text);<o:p></o:p></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></o:p></p>
 <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></o:p></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
QUERY PLAN<o:p></o:p></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">--------------------------- \
--------------------------------------------------------------------------------------------------------------------------------------<o:p></o:p></p>
 <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">HashAggregate&nbsp; \
(cost=2100211.06..2100211.11 rows=5 width=4) (actual time=27095.470..27095.487 \
rows=138 loops=1)<o:p></o:p></p> <p class="MsoNormal">... <o:p></o:p></p>
<p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></o:p></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">--plan \
2, only 1 second spent on index scan of term_weekly table, however, as it selects the \
big table to do the hashing, it takes 22 seconds for the hash to complete. The \
advantage  get from index has been totally lost because of this join \
order.<o:p></o:p></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;<o:p></o:p></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp \
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
QUERY PLAN<o:p></o:p></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">--------------------------- \
-------------------------------------------------------------------------------------- \
--------------------------------------------------------------------------<o:p></o:p></p>
 <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">HashAggregate&nbsp; \
(cost=1429795.17..1429795.22 rows=5 width=4) (actual time=22991.289..22991.307 \
rows=138 loops=1)<o:p></o:p></p> <p class="MsoNormal">...<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Am I reading something wrong here? I haven't looked all the \
plan, but the second is faster (overall), so why do you think you need a hint or \
change what the planner choose? For me looks like using the index is the best for \
this situation.  Could you try running this multiple times and taking the min/max/avg \
time of both?<o:p></o:p></p> </div>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">The difference in time could be a caching effect, not a \
reproducible difference.<o:p></o:p></p> </div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">The 2nd plan uses 3GB of memory, and there might be better uses \
for that memory.<o:p></o:p></p> </div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Currently memory is un-costed, other than &quot;cliff \
costing&quot; once you thinks it will exceed work_mem, which I think is a problem. \
&nbsp;Just because I will let you use 4GB of memory if you will really benefit from \
it, doesn't mean you should use  4GB gratuitously.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal"><span \
style="font-size:11.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:black">Suya, \
what happens if you lower work_mem setting? &nbsp;Does it revert to the plan you \
want?</span><o:p></o:p></p> </div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Jeff<o:p></o:p></p>
<p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
 <div class="MsoNormal" align="center" style="text-align:center"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">
 <hr size="2" width="100%" align="center">
</span></div>
<p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Hey \
Jeff,<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">It's \
quite interesting, after I reduced the work_mem to 1GB, it chose the right plan. \
Also, if I create a temporary table and then join it with the temporary  table, it \
also chose the right plan. Is this a defect of PG optimizer? While doing hash join, \
it's unable to pick the small table to be the hash probe table while the query is \
complicated (not really that complicated in this case)<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
QUERY PLAN<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">------------------------------------------------------------------------------ \
-------------------------------------------------------------------------------------------------------------------<o:p></o:p></span></p>
 <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">HashAggregate&nbsp; \
(cost=1524294.96..1524295.01 rows=5 width=4) (actual time=13409.960..13409.979 \
rows=138 loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp; \
-&gt;&nbsp; Hash Join&nbsp; (cost=143.25..1524294.94 rows=5 width=4) (actual \
time=10648.440..13409.718 rows=160 loops=1)<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Hash Cond: (((n.b_id)::text = (s.b_id)::text) AND (n.date = \
s.date))<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Append&nbsp; (cost=0.00..862153.59 rows=37828460 width=52) (actual \
time=0.006..8152.938 rows=37828459 loops=1)<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Seq Scan on lookup_weekly n&nbsp; (cost=0.00..0.00 rows=1 width=524) \
(actual time=0.000..0.000 rows=0 loops=1)<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Seq Scan on lookup_weekly_20131130 n_1&nbsp; (cost=0.00..117764.18 \
rows=5158718 width=52) (actual time=0.006..743.985 rows=5158718 \
loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Seq Scan on lookup_weekly_20131207 n_2&nbsp; (cost=0.00..117764.18 \
rows=5158718 width=52) (actual time=0.003..894.061 rows=5158718 \
loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Seq Scan on lookup_weekly_20131214 n_3&nbsp; (cost=0.00..117764.18 \
rows=5158718 width=52) (actual time=0.008..746.660 rows=5158718 \
loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Seq Scan on lookup_weekly_20131221 n_4&nbsp; (cost=0.00..117764.18 \
rows=5158718 width=52) (actual time=0.004..750.305 rows=5158718 \
loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Seq Scan on lookup_weekly_20131228 n_5&nbsp; (cost=0.00..117764.18 \
rows=5158718 width=52) (actual time=0.004..741.233 rows=5158718 \
loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Seq Scan on lookup_weekly_20140426 n_6&nbsp; (cost=0.00..91715.42 \
rows=4042442 width=52) (actual time=0.010..595.792 rows=4042442 \
loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Seq Scan on lookup_weekly_20140503 n_7&nbsp; (cost=0.00..93516.49 \
rows=4118149 width=52) (actual time=0.009..598.208 rows=4118149 \
loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Seq Scan on lookup_weekly_20140329 n_8&nbsp; (cost=0.00..88100.78 \
rows=3874278 width=52) (actual time=0.004..574.846 rows=3874278 \
loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Hash&nbsp; (cost=142.77..142.77 rows=32 width=61) (actual \
time=0.924..0.924 rows=553 loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Buckets: 1024&nbsp; Batches: 1&nbsp; Memory Usage: 43kB<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Append&nbsp; (cost=0.00..142.77 rows=32 width=61) (actual \
time=0.031..0.752 rows=553 loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Seq Scan on term_weekly s&nbsp; (cost=0.00..0.00 rows=1 width=520) \
(actual time=0.000..0.000 rows=0 loops=1)<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Filter: (term = 'cat'::text)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Index Scan using idx_term_weekly_20140503_3 on term_weekly_20140503 \
s_1&nbsp; (cost=0.56..36.70 rows=8 width=46) (actual time=0.031..0.225  rows=166 \
loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Index Cond: (term = 'cat'::text)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Index Scan using idx_term_weekly_20140510_3 on term_weekly_20140510 \
s_2&nbsp; (cost=0.56..36.70 rows=8 width=46) (actual time=0.023..0.192  rows=152 \
loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Index Cond: (term = 'cat'::text)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Index Scan using idx_term_weekly_20140517_3 on term_weekly_20140517 \
s_3&nbsp; (cost=0.56..36.70 rows=8 width=46) (actual time=0.022..0.176  rows=135 \
loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Index Cond: (term = 'cat'::text)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
-&gt;&nbsp; Index Scan using idx_term_weekly_20140524_3 on term_weekly_20140524 \
s_4&nbsp; (cost=0.56..32.68 rows=7 width=46) (actual time=0.016..0.126  rows=100 \
loops=1)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:# \
1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Index Cond: (term = 'cat'::text)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Total \
runtime: 13410.097 ms<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Thanks,<o:p></o:p></span></p>
 <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Suya<o:p></o:p></span></p>
 <p class="MsoNormal"><span \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
 </div>
</div>
</div>
</div>
</div>
</body>
</html>



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

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