List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:March 13 2009 11:46am
Subject:Re: proposed design for UNION Order By optimization
View as plain text  
Hi, Eric!

On Feb 19, Eric Jensen wrote:
> On Feb 19, 2009, at 2:33 AM, Sergei Golubchik wrote:
>> On Feb 18, Eric Jensen wrote:
>>
>> You want to create a temporary table with a btree index, put all union
>> data into it, and then retrieve rows in the index order ?
>
> No, not all union data, only the rows necessary for performing the merge, 
> using the index to select the next top value that determines which 
> component select to read a new row from next.

Ah! Okay, now I understand.

> 4. make st_select_lex_unit::exec use k-way merge logic relying on this
> one-result-at-a-time fetching to retrive up to LIMIT n results
> treating our temp table with its ordered index as a heap

Wouldn't it be better to use a heap as a heap, not btree as a heap ?
Heap is faster than btree, and MySQL has a heap implementation in
mysys/queues.c

Regards / Mit vielen Grüßen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Engineer/Server Architect
/_/  /_/\_, /___/\___\_\___/  Sun Microsystems GmbH, HRB München 161028
       <___/                  Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring
Thread
Fwd: proposed design for UNION Order By optimizationEric Jensen18 Feb
  • Re: proposed design for UNION Order By optimizationBaron Schwartz19 Feb
Re: proposed design for UNION Order By optimizationSergei Golubchik19 Feb
  • Re: proposed design for UNION Order By optimizationBaron Schwartz19 Feb
    • Re: proposed design for UNION Order By optimizationSergei Golubchik19 Feb
  • Re: proposed design for UNION Order By optimizationEric Jensen19 Feb
    • Re: proposed design for UNION Order By optimizationSergei Golubchik13 Mar