Back-port the code to optimize ORDER BY with small LIMIT from mysql 5.6

Description

Within this task the patches that support a more efficient handling of
the queries with ORDER BY <order> LIMIT <n>, such that n is small enough and
no indexes are used for order, will be back-ported from 5.6. The feature were developed in WL#1393.

Environment

None

Status

Assignee

Igor Babaev

Reporter

Igor Babaev

Labels

None

External issue ID

None

External issue ID

None

Fix versions

Priority

Major
Configure