List:Internals« Previous MessageNext Message »
From:Eric Jensen Date:March 13 2009 5:31pm
Subject:proposed design for UNION Order By optimization
View as plain text  
I still feel more comfortable doing the temp table version first, but  
you should ask him for the patch so that we can base version 2 on it.

thanks,
eric

On Mar 13, 2009, at 9:54 AM, Igor Babaev wrote:

>
>
> Eric Jensen wrote:
>> below
>> On Mar 13, 2009, at 4:46 AM, Sergei Golubchik wrote:
>>>
>>>> 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
>> would be better indeed!  however, i could not find another example  
>> of a select result class that reads results from a heap.  from what  
>> i remember, much of the logic for reading from an intermediate  
>> result set is specific to reading from a temporary table.  for  
>> example, i don't know where to find all the proper comparators to  
>> execute an arbitrary order by in the heap.  the heap seems like  
>> version two to me, unless i'm mistaken about the difficulty of  
>> storing intermediate row results in it, performing comparisons on  
>> them, and feeding them back to the user there a select result class  
>> that behaves like the ones that read from temporary tables.
>
> Eric,
>
> Somewhere in 2005 ago Evgeny Potemkin (eugene@stripped) implemented  
> ORDER BY <list> LIMIT N employing priority queue (heap) from mysys/ 
> queues.c.
> I'm pretty sure he still has that patch in his archives.
> Would you like to contact Evgeny or you'd prefer me to ask him for  
> that patch?
> The patch most probably will help you.
>
> Regards,
> Igor.
>
>
> -- 
> MySQL Internals Mailing List
> For list archives: http://lists.mysql.com/internals
> To unsubscribe:    http://lists.mysql.com/internals? 
> unsub=ej@stripped
>


Thread
proposed design for UNION Order By optimizationEric Jensen13 Mar
  • RE: proposed design for UNION Order By optimizationRick James13 Mar
  • Re: proposed design for UNION Order By optimizationEric Jensen6 Jun
    • RE: proposed design for UNION Order By optimizationRick James6 Jun
    • Re: proposed design for UNION Order By optimizationEric Jensen7 Jun
    • Re: proposed design for UNION Order By optimizationEric Jensen5 Jul
      • Re: proposed design for UNION Order By optimizationEric Jensen5 Jul
        • Re: proposed design for UNION Order By optimizationEric Jensen6 Jul
Re: proposed design for UNION Order By optimizationEric Jensen6 Jun
Re: proposed design for UNION Order By optimizationEric Jensen12 Jul