<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic What does stats partitions do? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448282#M127009</link>
    <description>&lt;P&gt;What does stats partitions do? How would you use this? &lt;/P&gt;

&lt;P&gt;Sample query: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|stats **partitions=1** latest(Insert_Text) by field_1 field_2 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The partition and by fields can be whatever you specify. I just would like to understand what is going on here.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Feb 2019 17:52:48 GMT</pubDate>
    <dc:creator>ryhluc01</dc:creator>
    <dc:date>2019-02-07T17:52:48Z</dc:date>
    <item>
      <title>What does stats partitions do?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448282#M127009</link>
      <description>&lt;P&gt;What does stats partitions do? How would you use this? &lt;/P&gt;

&lt;P&gt;Sample query: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|stats **partitions=1** latest(Insert_Text) by field_1 field_2 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The partition and by fields can be whatever you specify. I just would like to understand what is going on here.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 17:52:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448282#M127009</guid>
      <dc:creator>ryhluc01</dc:creator>
      <dc:date>2019-02-07T17:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: What does stats partitions do?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448283#M127010</link>
      <description>&lt;P&gt;Well the dox say that &lt;CODE&gt;1&lt;/CODE&gt; is the default value for &lt;CODE&gt;partitions&lt;/CODE&gt; so your search can drop it with no change.  The documentation is useless on this parameter.  You ask a good question.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 20:59:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448283#M127010</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-07T20:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: What does stats partitions do?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448284#M127011</link>
      <description>&lt;P&gt;Right? The documentation on the subject is not helpful at all. Thanks @woodcock. Now I am just hoping someone else will know. &lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 21:13:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448284#M127011</guid>
      <dc:creator>ryhluc01</dc:creator>
      <dc:date>2019-02-07T21:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: What does stats partitions do?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448285#M127012</link>
      <description>&lt;P&gt;I submitted feedback at the bottom of the documentation page, asking for more detail.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 21:37:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448285#M127012</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-07T21:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: What does stats partitions do?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448286#M127013</link>
      <description>&lt;P&gt;Thanks @woodcock! You're the best. &lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 14:15:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448286#M127013</guid>
      <dc:creator>ryhluc01</dc:creator>
      <dc:date>2019-02-08T14:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: What does stats partitions do?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448287#M127014</link>
      <description>&lt;P&gt;If everybody in any community does his little part, the experience for everybody improves dramatically.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 15:37:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448287#M127014</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-08T15:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: What does stats partitions do?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448288#M127015</link>
      <description>&lt;P&gt;The &lt;STRONG&gt;partitions&lt;/STRONG&gt; argument runs the reduce step (in parallel reduce processing) with multiple threads in the same search process on the same machine.  Compare that with &lt;STRONG&gt;parallel reduce&lt;/STRONG&gt; that runs the reduce step in parallel on multiple machines.&lt;/P&gt;

&lt;P&gt;Parallel reduce is implemented with the &lt;STRONG&gt;redistribute&lt;/STRONG&gt; command: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Redistribute"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Redistribute&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;In testing, the run times for a search using &lt;CODE&gt;partitions=5&lt;/CODE&gt; shows no difference as compared to &lt;CODE&gt;partitions=1&lt;/CODE&gt;, using this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=5000000
| streamstats count as i
| eval a=floor(i/10), b=floor(i/100), c=floor(i/1000), d=floor(i/10000), e=floor(i/100000)
| stats partitions=5 count by a, b, c, d, e
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this example, we are able to observe an ~9 second difference in run times:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=500000
| streamstats count as i
| eval j=mvrange(0,10)
| stats partitions=15 count by i,j
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With &lt;CODE&gt;partitions=15&lt;/CODE&gt; the search completes in 27 seconds. With &lt;CODE&gt;partitions=1&lt;/CODE&gt; the search completes in 36 seconds.&lt;/P&gt;

&lt;P&gt;The likely issue with the &lt;STRONG&gt;partitions&lt;/STRONG&gt; argument as compared to the &lt;STRONG&gt;redistribute&lt;/STRONG&gt; command, is the threads are competing for memory on the same machine - and memory usage is one of the significant factors that cause high-cardinality stats to perform poorly. Partitioning the memory usage across different machines, as the &lt;STRONG&gt;redistribute&lt;/STRONG&gt; command does, eliminates that competition.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 16:19:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-does-stats-partitions-do/m-p/448288#M127015</guid>
      <dc:creator>lstewart_splunk</dc:creator>
      <dc:date>2019-04-24T16:19:33Z</dc:date>
    </item>
  </channel>
</rss>

