title: Django: query set, multiple filters. Can i set the order in which the WHERE clause is formed so that it will help me in indexing
body: <p>I have the following query in django:</p>
  <pre><code>            end_date = timezone.now()
              start_date = end_date + timedelta(-5*365)
              queryset = (
                              DailyPriceHistory
                              .objects
                              .filter(symbol=symbol,datetime_utc__range=(start_date, end_date))
                              .order_by('datetime')
                              .order_by('creation_time')
                              .values_list('high','low','open','datetime','close','creation_time')
                          )
  </code></pre>
  <p>the Sql it generates is</p>
  <pre><code>SELECT `daily_price_history`.`high`,
         `daily_price_history`.`low`,
         `daily_price_history`.`open`,
         `daily_price_history`.`datetime`,
         `daily_price_history`.`close`,
         `daily_price_history`.`creation_time`
  FROM `daily_price_history`
  WHERE (`daily_price_history`.`datetime_utc`
          BETWEEN '2015-12-04 18:43:28.710229'
              AND '2020-12-02 18:43:28.710229'
          AND `daily_price_history`.`symbol` = 'A')
  ORDER BY `daily_price_history`.`creation_time` ASC
  </code></pre>
  <p>Currently i have <code>symbol</code> and <code>datatime</code> as seperately indexed columns</p>
  <p>I found why the filter sequence is not followed. i.e <code>.filter(symbol=symbol,datetime_utc__range=(start_date, end_date))</code></p>
  <p>I wanted</p>
  <pre><code>WHERE (`daily_price_history`.`symbol` = 'A'
     AND `daily_price_history`.`datetime_utc`
        BETWEEN '2015-12-04 18:43:28.710229'
            AND '2020-12-02 18:43:28.710229')
  </code></pre>
  <p>but it uses</p>
  <pre><code>WHERE (`daily_price_history`.`datetime_utc`
             BETWEEN '2015-12-04 18:43:28.710229'
                 AND '2020-12-02 18:43:28.710229'
             AND `daily_price_history`.`symbol` = 'A')
  </code></pre>
  <p>Also i dont see <code>order_by('datetime')</code> in the sql, is this because <code>datetime</code> is indexed</p>