MySQL full-text index, joint index, like query, java basic tutorial, full version pdf

mysql full-text text index joint

While limiting to the above types , You have to include any of the following codes ( That is to say OR Inquire about )

jy1577683381775

jy1577683380808

jy1577683379178

jy1577683378676

jy1577683377617

jy1577683376672

jy1577683375903

jy1578385720787

jy1499916986208

jy1499917112460

jy1499917093400

jy1499917335579

jy1499917334770

jy1499917333339

jy1499917331557

jy1499917330833

jy1499917329615

jy1499917328496

jy1576922006950

jy1499916993558

jy1499916992308

jy1499917003454

jy1499917002952

The following are listed respectively 4 Two ways to query outline Field , Give the corresponding query time and the number of scanning lines

One 、like Inquire about

========

Time consuming 248 millisecond

SELECT * FROM tmp_test_course

WHERE type=5 AND del=2 AND is_leaf=1

AND (

outline like ‘%jy1577683381775%’

OR outline like ‘%jy1577683380808%’

OR outline like ‘%jy1577683379178%’

OR outline like ‘%jy1577683378676%’

OR outline like ‘%jy1577683377617%’

OR outline like ‘%jy1577683376672%’

OR outline like ‘%jy1577683375903%’

OR outline like ‘%jy1578385720787%’

OR outline like ‘%jy1499916986208%’

OR outline like ‘%jy1499917112460%’

OR outline like ‘%jy1499917093400%’

OR outline like ‘%jy1499917335579%’

OR outline like ‘%jy1499917334770%’

OR outline like ‘%jy1499917333339%’

OR outline like ‘%jy1499917331557%’

OR outline like ‘%jy1499917330833%’

OR outline like ‘%jy1499917329615%’

OR outline like ‘%jy1499917328496%’

OR outline like ‘%jy1576922006950%’

OR outline like ‘%jy1499916993558%’

OR outline like ‘%jy1499916992308%’

OR outline like ‘%jy1499917003454%’

OR outline like ‘%jy1499917002952%’

)

11561958-385804bd4d072a07.png

EXPLAIN The analysis results are as follows , Full table scan

11561958-83c378064f7b7a42.png

Two 、json Function query

==========

Using functions JSON_SEARCH, For more functions, see MySQL Official documents

You can see , Query time consuming 196 millisecond , A little faster

SELECT * FROM tmp_test_course

WHERE type=5 AND del=2 AND is_leaf=1

AND

(

JSON_SEARCH(outline, ‘one’, ‘jy1577683381775’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1577683380808’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1577683379178’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1577683378676’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1577683377617’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1577683376672’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1577683375903’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1578385720787’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499916986208’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499917112460’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499917093400’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499917335579’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499917334770’)

《 A big factory Java Analysis of interview questions + Back end development learning notes + The latest architecture explanation video + Practical project source code handout 》

【docs.qq.com/doc/DSmxTbFJ1cmN1R2dB】 Full content open source sharing

IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499917333339’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499917331557’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499917330833’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499917329615’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499917328496’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1576922006950’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499916993558’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499916992308’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499917003454’) IS NOT NULL OR

JSON_SEARCH(outline, ‘one’, ‘jy1499917002952’) IS NOT NULL

)

11561958-bb223441a138b5ad.png

EXPLAIN The analysis results are as follows , Or full scan

11561958-73ac9a0b66e7e9b3.png

3、 ... and 、 Union index query

========

Let's create a joint index for this table ( I wanted to build a type-del-is_leaf-outline The index of , however outline The field is too long, limit , So just add type-del-is_leaf Joint index of

ALTER TABLE tmp_test_course ADD KEY type-del-is_leaf (type,del,is_leaf)

Add the index and then execute like and json Inquire about , Significantly faster .

like Execution used 136 millisecond ,json Query used 82.6 millisecond , It can be seen that json Type used json Function query ratio like fast

11561958-93bb93dfe18f9e15.png

11561958-2b3f82e23d010ee6.png

EXPLAIN The analysis results are as follows , The number of rows scanned by both queries is limited to 2931 That's ok

11561958-6008219665ac6f12.png

copyright:author[m0_ sixty-four million eight hundred and sixty-seven thousand f],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/01/202201262128106241.html