Get the App
SLTechnology News&Howtos  ›  Database  › 

MariaDB10.2.6 enables Mroonga storage engine for full-text indexing

Shulou Source: shulou.com Published: 2022-06-01 10:15:53 09月28日 Update

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

Here is a direct demonstration of how to enable the mroonga storage engine on MariaDB

1) load the mroonga plug-in

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 (100) not null,notes text,fulltext index (notes)) engine=mroonga

3) insert some data randomly

MariaDB [jerry] > insert into T1 values ("wipe", "I won't tell you")

Query OK, 1 row affected (0.00 sec)

MariaDB [jerry] > insert into T1 values (2'la','I won't tell you')

Query OK, 1 row affected (0.01sec)

MariaDB [jerry] > insert into T1 values.

Query OK, 1 row affected (0.00 sec)

MariaDB [jerry] > insert into T1 values (4Dasoma Investment Co., Ltd.)

Query OK, 1 row affected (0.00 sec)

MariaDB [jerry] > insert into T1 values (5 miner kukumimiluluju 'Sema cross-border e-commerce co., Ltd')

Query OK, 1 row affected (0.00 sec)

MariaDB [jerry] > insert into T1 values (6) 'Wang Sicong', 'Wang Dad United Da Senma 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 ('Big Senma' in BOOLEAN MODE)

+-+

| | id | name | notes | |

+-+

| | 4 | victor | Da Senma Investment Co., Ltd. |

| | 6 | Wang Sicong | Father Wang United Da Senma 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 notes has been used, and only one row needs to be scanned

MariaDB [jerry] > explain select * from T1 where match (notes) against ('Big Senma' 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)

Tags: Sema Company Limited Co. Ltd. E-commerce Cross-border full text engine Storage Dad Sicong Investment Union Index Line function Command plug-in data clothing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Docker OPPO Reno Redmi macOS