WL#7123: Additional query optimization for Fulltext Search

Status: Complete

This is a placeholder on some optimization needed from optimizer side for InnoDB
fulltext searches.

It has 2 areas:

Area 1. Some condition push down from server layer to InnoDB

  a) hint on no ranking is needed. For example, select count(*)
  b) hint on "select limit" with no where clause (asc/desc), so we only need to
keep top/bottom ranked items
  c) hint on "order by match" (ranking), whether it is asc or desc
  d) hint on "select limit" with where clause on match (ranking) > X (asc/desc)


Area 2. Simplify post search result processing:

I notice there are additional call to innobase_fts_retrieve_ranking() for a
simple select match call:

SELECT * FROM articles
        WHERE MATCH (title,body)
        AGAINST ('Database' IN NATURAL LANGUAGE MODE);

Stack:

innobase_fts_retrieve_ranking
Item_func_match::val_real
..
evaluate_join_record
sub_select
JOIN::exec
mysql_execute_select


Please notice when it comes to ha_innobase::ft_read to retrieve result data, we
sort the result (doc_id) by fts_query_sort_result_on_rank(). So the resulting
Doc ID is already sorted with ranking order. Why there is additional request for
ranking? it seems to be overhead to do such retrieval.

So I would like this result retrieval process could be checked and straightened 
out.

User Documentation
==================

None required.