首页 > 数据库 >数据库应用2023-04-01

数据库应用2023-04-01

时间:2023-04-01 14:56:36浏览次数:44  
标签:index fulltext 01 name 04 column text 2023 table

 

index vs fulltext index in mysql

In MySQL, an index is a data structure that improves the speed of data retrieval operations on a table. It works by allowing the database to find and retrieve specific rows more quickly, by reducing the amount of data that needs to be scanned to find the desired rows.

A fulltext index, on the other hand, is a type of index that is designed specifically for full-text searches. It is used to speed up text-based search queries by creating a separate data structure that indexes the words in the text column of a table. When a search query is executed, the fulltext index is used to quickly identify the rows that contain the specified search terms, without having to scan the entire text column.

The main difference between a regular index and a fulltext index is that a regular index is used for exact matches on specific columns, whereas a fulltext index is used for text-based searches that match specific words or phrases within a column. Additionally, a fulltext index is typically much larger than a regular index, as it needs to store information about the position and frequency of each word within the indexed text column.

In summary, if you need to search for specific words or phrases within a text column, a fulltext index is the way to go. However, if you are only searching for exact matches on a specific column, a regular index is sufficient.

 

alter table add index in mysql

ALTER TABLE table_name
ADD [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name (column1, column2, ...);

 

  • table_name: The name of the table you want to add an index to.
  • [UNIQUE|FULLTEXT|SPATIAL]: Optional. Specifies the type of index to create. UNIQUE creates a unique index, FULLTEXT creates a full-text index, and SPATIAL creates a spatial index.
  • index_name: The name of the index you want to create.
  • (column1, column2, ...): The name of one or more columns that you want to include in the index.

 

 

The correct syntax for adding multiple indexes in MySQL using ALTER TABLE is:

sql ALTER TABLE table_name ADD INDEX index1_name (column1), ADD UNIQUE index2_name (column2), ADD FULLTEXT index3_name (column3);

Here's an example that adds two indexes:

sql ALTER TABLE student ADD INDEX idx_sNo (sNo), ADD UNIQUE idx_sName (sName);

This will add an index named idx_sNo on the sNo column and a unique index named idx_sName on the sName column of the student table.

 

 

标签:index,fulltext,01,name,04,column,text,2023,table
From: https://www.cnblogs.com/chucklu/p/17278612.html

相关文章

  • [oeasy]python0122_日韩字符_日文假名_JIS_Shift_韩国谚文
    日文假名和韩国谚文回忆上次内容上次回顾了非ascii的拉丁字符编码的进化过程0-127是ascii的领域 世界各地编码分布拉丁字符扩展ascii共16种由iso组织制定从iso-8859-1到iso-8859-16 无法同时显示俄文和法文  此......
  • [oeasy]python0122_日韩字符_日文假名_JIS_Shift_韩国谚文
    日文假名和韩国谚文回忆上次内容上次回顾了非ascii的拉丁字符编码的进化过程0-127是ascii的领域世界各地编码分布拉丁字符扩展ascii共16种由iso组织制定从iso-8859-1到iso-8859-16无法同时显示俄文和法文此时中日韩的文字也需要进入计算机象形文字的字符集超级巨大日本......
  • day01
    剑指Offer09.用两个栈实现队列leetcode传送门用两个栈实现一个队列。队列的声明如下,请实现它的两个函数appendTail和deleteHead,分别完成在队列尾部插入整数和在队列头部删除整数的功能。(若队列中没有元素,deleteHead 操作返回-1)分析:栈是操作受限的线性表,只能在一......
  • x210-2023-04-01
    1、由于之前提到过使用的USB转网口虽然能用,但是在笔记本上会显示红叉,所以不能保证这个会不会给调试带来更多的不确定性,而且刚开始移植用的kernel是kernel.org的,所以在未开启以及添加对应的网络驱动之前,想要直接使用NFS去挂载根文件系统是不大现实的,所以只能选择ramdisk方式(因为ram......
  • 2023年国内免费使用的chatgpt镜像网站
       小程序于2023.03.28停服整改,预计4.5日前恢复使用,期间可以使用网页版本代替https://service-ht6dwx8s-1256721724.gz.apigw.tencentcs.com/release/#/chat/永久性免费chatgpt网页版时间:2023.03.29起投入使用 ......
  • 程序设计应用2023-04-01
    数据库配置#Database#https://docs.djangoproject.com/en/4.1/ref/settings/#databasesDATABASES={  'default':{    'ENGINE':'django.db.backends.sqlite3',    'NAME':BASE_DIR/'db.sqlite3',  ......
  • 2023年4月1日09:56:44计划
    昨天晚上玩手机睡挺晚的,以后如果睡不着就听歌,不能老玩手机。昨天的Git 克隆速度太慢了,还不如自己的gitHut加速器,去买个Git加速器又不划算,所以算了,算白学了,因为自己也没有一定要去上传什么项目到Github上。昨天的有效数组还是没有解决,但自己写了一到算法题,今天要把剩下的解决,并......
  • x210-2023-03-31
    1、在参考网上的一些开启NFS文章时,发现有一个问题,就是他们在---NetworkFileSystems底下都有一个[]RootFilesystemonNFS,但是自己配置这里却没有,而且刚开始的时候也是弄不出来,然后去网上查了个遍,有说直接修改xxx_defconfig文件添加CONFIG_NFS_FS=y、CONFIG_IP_PNP=y的,可是加......
  • 2023.4.1
    B-ProblemB.sophistry_2021CCPC新疆省赛(重现赛)@KFC_ovo(nowcoder.com)//当需要后边的信息时,就只能从后往前推 #include<bits/stdc++.h>usingnamespacestd;typedeflonglongll;constintN=1e5+10;//线性dplln,d,m;//发言n天lla[N];lldp[N];//dp[i]表......
  • 2023-04-01-循环队列CycleSqQueue的基本操作
    //循环链表//牺牲一个单元来区分队空还是队满#include<stdio.h>#include<stdbool.h>#defineMAXSIZE6typedefstruct{intdata[MAXSIZE];intfront,rear;}CySqQueue;voidinitCySqQueue(CySqQueue*C)//初始化循环链表{C->front=0;C->rear=0;......