<?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 Re: What is the relation between the Splunk inner/left join and the ones in relational databases? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-relation-between-the-Splunk-inner-left-join-and-the/m-p/391290#M113950</link>
    <description>&lt;P&gt;DO NOT USE JOINS IN SPLUNK.  See here for visual representations:&lt;BR /&gt;
&lt;A href="https://goo.gl/images/zyDpMD"&gt;https://goo.gl/images/zyDpMD&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Continuing with the explanation of @kashz:&lt;BR /&gt;
Assume:&lt;BR /&gt;
&lt;CODE&gt;sourcetype=A&lt;/CODE&gt; contains &lt;CODE&gt;{ip, more-columns-specific-to-sourcetype-A}&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;sourcetype=B&lt;/CODE&gt; contains &lt;CODE&gt;{ip, more-columns-specific-to-sourcetype-B}&lt;/CODE&gt;&lt;BR /&gt;
and furthermore that you have a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=A AND sourcetype=A) OR (index=B AND sourcetype=B)
| stats dc(sourcetype) AS sourcetypeCount values(*) AS * BY ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;INNER JOIN on the &lt;CODE&gt;ip&lt;/CODE&gt; field between them will return only those contents that are matching in the both &lt;CODE&gt;sourcetype&lt;/CODE&gt; values on the &lt;CODE&gt;ip&lt;/CODE&gt; field.  To do this, finish your search with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where sourcetypeCount=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;LEFT JOIN A on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return the FULL &lt;CODE&gt;sourcetype=A&lt;/CODE&gt; dataset (the "left" one) and only those contents from the &lt;CODE&gt;souretype=B&lt;/CODE&gt; dataset (the "right" one) which match on field &lt;CODE&gt;ip&lt;/CODE&gt;.  To do this, finish your search with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where sourcetype="A"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;LEFT JOIN B on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return the EXCLUSIVE &lt;CODE&gt;sourcetype=A&lt;/CODE&gt; dataset (the "left" one) that do not overlap the contents from the &lt;CODE&gt;souretype=B&lt;/CODE&gt; dataset (the "right" one) which match on field &lt;CODE&gt;ip&lt;/CODE&gt;.  To do this, finish your search with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where sourcetype="A" AND sourcetypeCount=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;RIGHT JOIN B on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return the FULL &lt;CODE&gt;sourcetype=B&lt;/CODE&gt; dataset (the "right" one) and only those contents from the &lt;CODE&gt;souretype=A&lt;/CODE&gt; dataset (the "left" one) which match on field &lt;CODE&gt;ip&lt;/CODE&gt;.  To do this, finish your search with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where sourcetype="B"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;RIGHT JOIN A on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return the EXCLUSIVE &lt;CODE&gt;sourcetype=B&lt;/CODE&gt; dataset (the "right" one) that do not overlap the contents from the &lt;CODE&gt;souretype=A&lt;/CODE&gt; dataset (the "left" one) which match on field &lt;CODE&gt;ip&lt;/CODE&gt;.  To do this, finish your search with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where sourcetype="B" AND sourcetypeCount=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OUTER JOIN on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return both datasets in FULL minus the events that that have &lt;CODE&gt;ip&lt;/CODE&gt; in both datasets.  To do this, finish your search with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where sourcetypeCount=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;FULL JOIN on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return both datasets in FULL.  To do this, do nothing.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2019 04:49:56 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-03-07T04:49:56Z</dc:date>
    <item>
      <title>What is the relation between the Splunk inner/left join and the ones in relational databases?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-relation-between-the-Splunk-inner-left-join-and-the/m-p/391288#M113948</link>
      <description>&lt;P&gt;What's the relation between the Splunk inner/left joins and the ones in relational databases, functionality and terminology wise?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Feb 2019 16:04:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-relation-between-the-Splunk-inner-left-join-and-the/m-p/391288#M113948</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2019-02-19T16:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: What is the relation between the Splunk inner/left join and the ones in relational databases?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-relation-between-the-Splunk-inner-left-join-and-the/m-p/391289#M113949</link>
      <description>&lt;P&gt;Splunk Documentation on Joins: &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.4/SearchReference/Join"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.4/SearchReference/Join&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;To give you a clear picture:&lt;BR /&gt;
Splunk only support &lt;CODE&gt;INNER&lt;/CODE&gt;, &lt;CODE&gt;LEFT&lt;/CODE&gt; and &lt;CODE&gt;OUTER&lt;/CODE&gt; joins where as in SQL based queries can have a lot more variations; the concept remains the same.&lt;/P&gt;

&lt;P&gt;Assume:&lt;BR /&gt;
DATASET-A contains &lt;CODE&gt;{ip, more-columns}&lt;/CODE&gt;&lt;BR /&gt;
DATASET-B contains &lt;CODE&gt;{ip, more-columns}&lt;/CODE&gt;&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;INNER JOIN on the &lt;CODE&gt;ip&lt;/CODE&gt; field between them will return only those contents that are matching in the both dataset on the &lt;CODE&gt;ip&lt;/CODE&gt; field.&lt;/LI&gt;
&lt;LI&gt;LEFT JOIN on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return the FULL DATASET-(left-one) and only those contents from the other dataset-(right-one) which match on field &lt;CODE&gt;ip&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;OUTER JOIN on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return both datasets in FULL with &lt;CODE&gt;null&lt;/CODE&gt; values entered in places where a field cannot be found based on the join condition.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 19 Feb 2019 21:56:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-relation-between-the-Splunk-inner-left-join-and-the/m-p/391289#M113949</guid>
      <dc:creator>kashz</dc:creator>
      <dc:date>2019-02-19T21:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: What is the relation between the Splunk inner/left join and the ones in relational databases?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-relation-between-the-Splunk-inner-left-join-and-the/m-p/391290#M113950</link>
      <description>&lt;P&gt;DO NOT USE JOINS IN SPLUNK.  See here for visual representations:&lt;BR /&gt;
&lt;A href="https://goo.gl/images/zyDpMD"&gt;https://goo.gl/images/zyDpMD&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Continuing with the explanation of @kashz:&lt;BR /&gt;
Assume:&lt;BR /&gt;
&lt;CODE&gt;sourcetype=A&lt;/CODE&gt; contains &lt;CODE&gt;{ip, more-columns-specific-to-sourcetype-A}&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;sourcetype=B&lt;/CODE&gt; contains &lt;CODE&gt;{ip, more-columns-specific-to-sourcetype-B}&lt;/CODE&gt;&lt;BR /&gt;
and furthermore that you have a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=A AND sourcetype=A) OR (index=B AND sourcetype=B)
| stats dc(sourcetype) AS sourcetypeCount values(*) AS * BY ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;INNER JOIN on the &lt;CODE&gt;ip&lt;/CODE&gt; field between them will return only those contents that are matching in the both &lt;CODE&gt;sourcetype&lt;/CODE&gt; values on the &lt;CODE&gt;ip&lt;/CODE&gt; field.  To do this, finish your search with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where sourcetypeCount=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;LEFT JOIN A on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return the FULL &lt;CODE&gt;sourcetype=A&lt;/CODE&gt; dataset (the "left" one) and only those contents from the &lt;CODE&gt;souretype=B&lt;/CODE&gt; dataset (the "right" one) which match on field &lt;CODE&gt;ip&lt;/CODE&gt;.  To do this, finish your search with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where sourcetype="A"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;LEFT JOIN B on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return the EXCLUSIVE &lt;CODE&gt;sourcetype=A&lt;/CODE&gt; dataset (the "left" one) that do not overlap the contents from the &lt;CODE&gt;souretype=B&lt;/CODE&gt; dataset (the "right" one) which match on field &lt;CODE&gt;ip&lt;/CODE&gt;.  To do this, finish your search with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where sourcetype="A" AND sourcetypeCount=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;RIGHT JOIN B on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return the FULL &lt;CODE&gt;sourcetype=B&lt;/CODE&gt; dataset (the "right" one) and only those contents from the &lt;CODE&gt;souretype=A&lt;/CODE&gt; dataset (the "left" one) which match on field &lt;CODE&gt;ip&lt;/CODE&gt;.  To do this, finish your search with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where sourcetype="B"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;RIGHT JOIN A on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return the EXCLUSIVE &lt;CODE&gt;sourcetype=B&lt;/CODE&gt; dataset (the "right" one) that do not overlap the contents from the &lt;CODE&gt;souretype=A&lt;/CODE&gt; dataset (the "left" one) which match on field &lt;CODE&gt;ip&lt;/CODE&gt;.  To do this, finish your search with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where sourcetype="B" AND sourcetypeCount=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OUTER JOIN on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return both datasets in FULL minus the events that that have &lt;CODE&gt;ip&lt;/CODE&gt; in both datasets.  To do this, finish your search with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where sourcetypeCount=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;FULL JOIN on the &lt;CODE&gt;ip&lt;/CODE&gt; field will return both datasets in FULL.  To do this, do nothing.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 04:49:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-relation-between-the-Splunk-inner-left-join-and-the/m-p/391290#M113950</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-03-07T04:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: What is the relation between the Splunk inner/left join and the ones in relational databases?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-relation-between-the-Splunk-inner-left-join-and-the/m-p/391291#M113951</link>
      <description>&lt;P&gt;Using &lt;CODE&gt;join&lt;/CODE&gt; is bad because it uses &lt;CODE&gt;subsearches&lt;/CODE&gt; which have time and results limits which are enforced without obvious indications leaving users with no easy way to know that the results are incomplete.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 18:02:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-relation-between-the-Splunk-inner-left-join-and-the/m-p/391291#M113951</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-02-18T18:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: What is the relation between the Splunk inner/left join and the ones in relational databases?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-relation-between-the-Splunk-inner-left-join-and-the/m-p/612006#M212793</link>
      <description>&lt;P&gt;Thank you for sharing the docs. They helped a lot.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 01:12:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-relation-between-the-Splunk-inner-left-join-and-the/m-p/612006#M212793</guid>
      <dc:creator>asveturi</dc:creator>
      <dc:date>2022-09-06T01:12:30Z</dc:date>
    </item>
  </channel>
</rss>

