title: Set a constant boundary query
body: <p>I am using Sqoop to import MySQL tables to HDFS. To do that, I use a free-form query import.</p>
  
  <pre><code>--query "SELECT $query_select FROM $table where \$CONDITIONS"
  </code></pre>
  
  <p>This query is quite slow because of the min(id) and the max(id) search. To improve performances, I've decided to use --boundary-query and specify manually lower-bound and upper-bound.
  ( <a href="https://www.safaribooksonline.com/library/view/apache-sqoop-cookbook/9781449364618/ch04.html" rel="nofollow">https://www.safaribooksonline.com/library/view/apache-sqoop-cookbook/9781449364618/ch04.html</a>):</p>
  
  <pre><code>--boundary-query "select 176862848, 172862848"
  </code></pre>
  
  <p>However, sqoop doesn't care about specified value and again tries to find minimum and maximum "id" by itself.</p>
  
  <pre><code>16/06/13 14:24:44 INFO tool.ImportTool: Lower bound value: 170581647
  16/06/13 14:24:44 INFO tool.ImportTool: Upper bound value: 172909234
  </code></pre>
  
  <p>The complete sqoop command:</p>
  
  <pre><code>sqoop-import -fs hdfs://xxxxxxxxx/ -D mapreduce.map.java.opts=" -Duser.timezone=Europe/Paris" -m $nodes_number\
      --connect jdbc:mysql://$server:$port/$database --username $username --password $password\
      --target-dir $destination_dir --boundary-query "select 176862848, 172862848"\
      --incremental append --check-column $id_column_name --last-value $last_value\
      --split-by $id_column_name --query "SELECT $query_select FROM $table where \$CONDITIONS"\
      --fields-terminated-by , --escaped-by \\ --enclosed-by '\"'
  </code></pre>
  
  <p>Does anyone has already met/solved this problem? Thanks</p>