1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-7317: Make an index ignorable to the optimizer

This feature adds the functionality of ignorability for indexes.
Indexes are not ignored be default.

To control index ignorability explicitly for a new index,
use IGNORE or NOT IGNORE as part of the index definition for
CREATE TABLE, CREATE INDEX, or ALTER TABLE.

Primary keys (explicit or implicit) cannot be made ignorable.

The table INFORMATION_SCHEMA.STATISTICS get a new column named IGNORED that
would store whether an index needs to be ignored or not.
This commit is contained in:
Varun Gupta
2021-02-25 19:59:51 +05:30
parent 71d30d01aa
commit f691d9865b
108 changed files with 2541 additions and 1422 deletions

View File

@ -381,6 +381,29 @@ public:
};
/* An ALTER INDEX operation that changes the ignorability of an index. */
class Alter_index_ignorability: public Sql_alloc
{
public:
Alter_index_ignorability(const char *name, bool is_ignored) :
m_name(name), m_is_ignored(is_ignored)
{
assert(name != NULL);
}
const char *name() const { return m_name; }
/* The ignorability after the operation is performed. */
bool is_ignored() const { return m_is_ignored; }
Alter_index_ignorability *clone(MEM_ROOT *mem_root) const
{ return new (mem_root) Alter_index_ignorability(*this); }
private:
const char *m_name;
bool m_is_ignored;
};
class Key :public Sql_alloc, public DDL_options {
public:
enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FULLTEXT, SPATIAL, FOREIGN_KEY};