Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report