MariaDB10.2.6 enabling the Mroonga storage engine for full-text indexing

Source: Internet
Author: User

As translated, Mroonga is a storage engine for MySQL. It provides fast full-text search functionality for all MySQL users.

Here's a direct demonstration of how to enable the Mroonga storage engine on MARIADB


1) Load Mroonga plugin

MariaDB [(None)]>INSTALL SONAME ' Ha_mroonga ';

MariaDB [(none)]> CREATE FUNCTION last_insert_grn_id RETURNS INTEGER SONAME ' ha_mroonga.so ';


2) Build a table and test it.

MariaDB [(none)]> CREATE database Jerry;

MariaDB [(none)]> Use Jerry

MariaDB [jerry]> CREATE TABLE t1 (ID int not null,name varchar (+) not null,notes Text,fulltext Index (notes)) engine =mroonga;


3) randomly inserting some data

MariaDB [jerry]> INSERT INTO T1 values (1, ' wipe ', ' I will not tell you ');

Query OK, 1 row Affected (0.00 sec)


MariaDB [jerry]> INSERT INTO T1 values (2, ' cheer ', ' I won't tell you ');

Query OK, 1 row affected (0.01 sec)


MariaDB [jerry]> INSERT INTO T1 values (3, ' Dashaba ', ' Mori horse costume ');

Query OK, 1 row Affected (0.00 sec)


MariaDB [jerry]> INSERT INTO T1 values (4, ' Victor ', ' Omori ma Investment Limited ');

Query OK, 1 row Affected (0.00 sec)


MariaDB [jerry]> INSERT INTO T1 values (5, ' Kukumimilulu ', ' Sen Ma cross-border e-commerce Co., Ltd. ');

Query OK, 1 row Affected (0.00 sec)


MariaDB [jerry]> INSERT INTO T1 values (6, ' constructed ', ' father Wang United Malaysia cross-border e-commerce Co., Ltd. ');

Query OK, 1 row Affected (0.00 sec)


4) query with the following command


MariaDB [jerry]> SELECT * from T1 where match (notes) against (' Omori horse ' in BOOLEAN MODE);

+----+-----------+--------------------------------------------------+

| ID | name | Notes |

+----+-----------+--------------------------------------------------+

| 4 | Victor | Omori Horse Investment Co., Ltd. |

| 6 | Constructed | Father Wang United Malaysia cross-border e-commerce Co., Ltd. |

+----+-----------+--------------------------------------------------+

2 rows in Set (0.00 sec)


5) Through the execution plan we can see that the full-text index of notes has been used, and only one line is scanned

MariaDB [jerry]> Explain select * from T1 where match (notes) against (' Omori horse ' in BOOLEAN MODE);

+------+-------------+-------+----------+---------------+-------+---------+------+------+---------------------- -------------+

| ID | Select_type | Table | Type | Possible_keys | Key | Key_len | Ref | Rows | Extra |

+------+-------------+-------+----------+---------------+-------+---------+------+------+---------------------- -------------+

| 1 | Simple | T1 | Fulltext | Notes | Notes |      0 |    | 1 | Using where with pushed condition |

+------+-------------+-------+----------+---------------+-------+---------+------+------+---------------------- -------------+

1 row in Set (0.00 sec)




This article is from the "operation and maintenance of life" blog, please make sure to keep this source http://jinyan2049.blog.51cto.com/881440/1942333

MariaDB10.2.6 enabling the Mroonga storage engine for full-text indexing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.