Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Yukhin <kyukhin@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Nikita Pettik <korablev@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH] sql: re-enable ORDER BY field filter optimization
Date: Mon, 25 Feb 2019 18:44:59 +0300	[thread overview]
Message-ID: <20190225154459.tl5eoedpcmvepik3@tarantool.org> (raw)
In-Reply-To: <20190213195252.38092-1-korablev@tarantool.org>

Hello,

On 13 Feb 22:52, Nikita Pettik wrote:
> When we replaced SQLite's ephemeral spaces with our ones, one
> optimization concerning ORDER BY clause was disabled. It allows to
> reduce number of fields in format of ephemeral space or sorter table.
> To illustrate how it works, consider example:
> 
> CREATE TABLE t (id INT PRIMARY KEY, b INT);
> SELECT * FROM t ORDER BY b;
> 
> To sort entries from t, ephemeral space with format [b, id, b] is
> created. One can see, that such format contains duplicate of b column.
> To avoid such situation, SQLite provides optimization which removes
> duplicates. Meanwhile, it doesn't change already set format of ephemeral
> (or sorter) space (and SQLite tolerates that format difference). That's
> why it was turned off. However, such optimization turns out to be not
> optional but required: some column values shouldn't be computed twice.
> For instance:
> 
> SELECT random() AS x FROM t ORDER BY x;
> 
> Without filtering fields from ephemeral space format, it would be like:
> [random(), random()]. In other words, results would be sorted by first
> call to random() function, but resulting set would consist of values
> given by second call of random(). So, to enable it, we should reduce
> field count in format of ephemeral space by number of matches between
> SELECT and ORDER BY column lists.
> 
> Also, type of return value for random() function has been fixed.
> 
> Closes #3783
> ---
> Branch: https://github.com/tarantool/tarantool/tree/np/gh-3783-enable-field-filter-order-by
> Issue: https://github.com/tarantool/tarantool/issues/3783

I've checked your patch into 2.1 branch.

--
Regards, Kirill Yukhin

      reply	other threads:[~2019-02-25 15:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13 19:52 [tarantool-patches] " Nikita Pettik
2019-02-25 15:44 ` Kirill Yukhin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190225154459.tl5eoedpcmvepik3@tarantool.org \
    --to=kyukhin@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH] sql: re-enable ORDER BY field filter optimization' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox