Commit graph

11 commits

Author SHA1 Message Date
Oleksandr Byelkin
ebeb4f93e8 MDEV-16327: Server doesn't account for engines that supports OFFSET on their own.
Engine get LIMIT/OFFSET info an can it use/reset.
2019-10-13 09:40:41 +02:00
Oleksandr Byelkin
eb0804ef5e MDEV-18553: MDEV-16327 pre-requisits part 1: isolation of LIMIT/OFFSET handling 2019-10-13 09:40:41 +02:00
Vicențiu Ciorbaru
cb248f8806 Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
iangilfillan
f0ec34002a Correct FSF address 2017-03-10 18:21:29 +01:00
Sergei Golubchik
3abfe76e2d remove unused group_by_handler::init() method
The assumption is that the engine should not need to
evaluate HAVING on the table->record[0] - the engine either
can evaluate HAVING internally before writing it to the
table->record[0], or it should leave it to the server,
that will evaluate HAVING(table->record[0]).

Similarly the engine should not need to evaluate ORDER
on the table->record[0]. Either it returns the data already
sorted, or the server will sort the table.
2015-10-05 17:14:16 +02:00
Sergei Golubchik
21175bb316 Don't use flags in the group_by_handler class
instead pass the whole query down and let the engine return
unsupported parts back
2015-10-05 17:14:15 +02:00
Sergei Golubchik
c93ac0a1c6 cleanups and simplifications 2015-10-05 17:14:15 +02:00
Sergei Golubchik
7ca8b4bbfa move internal API out from group_by_handler
into a Pushdown_query object
2015-10-05 17:14:15 +02:00
Sergei Golubchik
9ca3d9ea9c remove unused method 2015-10-05 17:14:15 +02:00
Sergei Golubchik
e8daa41885 typos in comments, minor stylistic edits 2015-10-05 17:14:14 +02:00
Monty
cf50e13fbd MDEV-6080: Allowing storage engine to shortcut group by queries
This task is to allow storage engines that can execute GROUP BY or
summary queries efficiently to intercept a full query or sub query from
MariaDB and deliver the result either to the client or to a temporary
table for further processing.

- Added code in sql_select.cc to intercept GROUP BY queries.
  Creation of group_by_handler is done after all optimizations to allow
  storage engine to benefit of an optimized WHERE clause and suggested
  indexes to use.
- Added group by handler to sequence engine and a group_by test suite as
  a way to test the new interface.
- Intercept EXPLAIN with a message "Storage engine handles GROUP BY"

libmysqld/CMakeLists.txt:
  Added new group_by_handler files
sql/CMakeLists.txt:
  Added new group_by_handler files
sql/group_by_handler.cc:
  Implementation of group_by_handler functions
sql/group_by_handler.h:
  Definition of group_by_handler class
sql/handler.h:
  Added handlerton function to create a group_by_handler, if the storage
  engine can intercept the query.
sql/item_cmpfunc.cc:
  Allow one to evaluate item_equal any time.
sql/sql_select.cc:
  Added code to intercept GROUP BY queries
  - If all tables are from the same storage engine and the query is
    using sum functions, call create_group_by() to check if the storage
    engine can intercept the query.
    - If yes:
       - create a temporary table to hold a GROUP_BY row or result
       - In do_select() intercept normal query execution by instead
         calling the group_by_handler to get the result
       - Intercept EXPLAIN
sql/sql_select.h:
  Added handling of group_by_handler
  Added caching of the original join tab (needed for cleanup after
  group_by handler)
storage/sequence/mysql-test/sequence/group_by.result:
  Test group_by_handler interface
storage/sequence/mysql-test/sequence/group_by.test:
  Test group_by_handler interface
storage/sequence/sequence.cc:
  Added simple group_by_engine for handling COUNT(*) and
  SUM(primary_key).  This was done as a test of the group_by_handler
  interface
2015-10-05 17:14:14 +02:00