title: How to find time intervals with no data points in InfluxDB
body: <p>I have a bunch of IoT sensors that upload second by second data to InfluxDB.  Since their network is unreliable, sometimes they do not report data.</p>
  
  <p>I'm trying to figure out how to determine time periods in InfluxDB for which there is no data, and am encountering some wacky behavior with subqueries.</p>
  
  <p>What I've tried so far:</p>
  
  <p>Count the number of points each second, for example:</p>
  
  <pre><code>select count(power) 
  from energy 
  where time &lt; '2017-05-14T00:05:10Z' 
    and time &gt;= '2017-05-14T00:04:30Z' 
  group by time(1s);
  </code></pre>
  
  <p>This looks promising, as it returns a result for each second in the interval and the count of data points:</p>
  
  <pre><code>...
  1494720297000000000 1  
  1494720298000000000 1
  1494720299000000000 0
  1494720300000000000 0
  ...
  </code></pre>
  
  <p>Now I want only the time periods where there are 0 points, however when I try this, only time ranges with non-zero numbers of points are reported:</p>
  
  <pre><code>select "points" 
  from 
      (select count(power) as "points" 
       from energy 
       where time &lt; '2017-05-14T00:05:10Z' 
         and time &gt;= '2017-05-14T00:04:30Z' 
       group by time(1s));
  </code></pre>
  
  <p>Returns:</p>
  
  <pre><code>...
  1494720297000000000 1
  1494720298000000000 1
  </code></pre>
  
  <p>No data after 1494720298000000000 is returned, even though the subquery does return rows.</p>
  
  <p>Any help would be appreciated in crafting a query or approach to identify only the areas of time where there is no data.</p>