1. 01 1月, 2020 1 次提交
    • K
      Allow #nulls_first and #nulls_last in PostgreSQL · 66b19b5d
      Kevin Deisz 提交于
      When using PostgreSQL, it's useful to be able to specify NULLS FIRST and NULLS LAST on ordered columns. With this commit you can do that now, as in:
      
      ```ruby
      User.arel_table[:first_name].desc.nulls_last
      ```
      66b19b5d
  2. 16 3月, 2019 1 次提交
    • R
      Support Optimizer Hints · 97347d8c
      Ryuta Kamizono 提交于
      We as Arm Treasure Data are using Optimizer Hints with a monkey patch
      (https://gist.github.com/kamipo/4c8539f0ce4acf85075cf5a6b0d9712e),
      especially in order to use `MAX_EXECUTION_TIME` (refer #31129).
      
      Example:
      
      ```ruby
      class Job < ApplicationRecord
        default_scope { optimizer_hints("MAX_EXECUTION_TIME(50000) NO_INDEX_MERGE(jobs)") }
      end
      ```
      
      Optimizer Hints is supported not only for MySQL but also for most
      databases (PostgreSQL on RDS, Oracle, SQL Server, etc), it is really
      helpful to turn heavy queries for large scale applications.
      97347d8c
  3. 25 9月, 2018 1 次提交
    • V
      Abandon TOP support. · 41b92914
      Vladimir Kochnev 提交于
      Initially, `TOP` was introduced to support `limit` for MSSQL database.
      Unlike PostgreSQL/MySQL/SQLite, MSSQL does not have native `LIMIT`/`OFFSET` support.
      The commit adding `TOP` is 1a246f71.
      
      However, it figured out that `TOP` implementation was weak and it's not sufficient
      to also support `OFFSET`, then `TOP` was substituted with
      `ROW_NUMBER()` subquery in be48ed30.
      This is a well known trick in MSSQL -
      https://stackoverflow.com/questions/2135418/equivalent-of-limit-and-offset-for-sql-server.
      
      So now we don't need this `visit_Arel_Nodes_Top` at all.
      It does nothing useful but also adds an extra space after `SELECT` when `LIMIT` is being
      used for **any** database.
      41b92914
  4. 24 2月, 2018 2 次提交