`
k1280000
  • 浏览: 203655 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Mysql refresh

    博客分类:
  • DBMS
 
阅读更多

Mysql Refresh

1. KEY,INDEX,UNIQUE,PRIMARY,FULL-TEXT区别

 

Differences

  • KEY or INDEX refers to a normal non-unique index. Non-distinct values for the index are allowed, so the index may contain rows with identical values in all columns of the index. These indexes don't enforce any restraints on your data so they are used only for making sure certain queries can run quickly.

  • UNIQUE refers to an index where all rows of the index must be unique. That is, the same row may not have identical non-NULL values for all columns in this index as another row. As well as being used to speed up queries, UNIQUE indexes can be used to enforce restraints on data, because the database system does not allow this distinct values rule to be broken when inserting or updating data.

    Your database system may allow a UNIQUE index to be applied to columns which allow NULL values, in which case two rows are allowed to be identical if they both contain a NULL value (the rationale here is that NULL is considered not equal to itself). Depending on your application, however, you may find this undesirable: if you wish to prevent this, you should disallow NULL values in the relevant columns.

  • PRIMARY acts exactly like a UNIQUE index, except that it is always named 'PRIMARY', and there may be only one on a table (and there should always be one; though some database systems don't enforce this). A PRIMARY index is intended as a primary means to uniquely identify any row in the table, so unlike UNIQUE it should not be used on any columns which allow NULL values. Your PRIMARY index should be on the smallest number of columns that are sufficient to uniquely identify a row. Often, this is just one column containing a unique auto-incremented number, but if there is anything else that can uniquely identify a row, such as "countrycode" in a list of countries, you can use that instead.

    Some database systems (such as MySQL's InnoDB) will store a table's records on disk in the order in which they appear in the PRIMARY index.

  • FULLTEXT indexes are different from all of the above, and their behaviour differs significantly between database systems. FULLTEXT indexes are only useful for full text searches done with the MATCH() / AGAINST() clause, unlike the above three - which are typically implemented internally using b-trees (allowing for selecting, sorting or ranges starting from left most column) or hash tables (allowing for selection starting from left most column).

    Where the other index types are general-purpose, a FULLTEXT index is specialised, in that it serves a narrow purpose: it's only used for a "full text search" feature.

Similarities

  • All of these indexes may have more than one column in them.

  • With the exception of FULLTEXT, the column order is significant: for the index to be useful in a query, the query must use columns from the index starting from the left - it can't use just the second, third or fourth part of an index, unless it is also using the previous columns in the index to match static values. (For a FULLTEXT index to be useful to a query, the query must use all columns of the index.)

 

总结一下,都是索引所以不用重复在一个列上使用多个以上关键字。full-text用在full text search 所以一般情况下不常用。

 

 

-------------------------------------------------------------------------------------------------------------------

合并操作可以减少阻塞和操作时间

ALTER TABLE XXX
ADD INDEX (xxx),
ADD INDEX (xxx2);

 

 

运行时更改表会阻塞除了SELECT之外的操作。
高可用性容错度高的主表复制技术来支持在线变更表结构,比如
oak-online-alter-table
以及facebook的在线变更工具OSC

 

 

 

 

 

 

分享到:
评论

相关推荐

    SUSE11安装MySql

    sudo zypper refresh ``` 接下来,我们开始安装MySQL服务器和客户端。在SLES11中,使用ZYPPER进行安装: ```bash sudo zypper install mysql-server mysql-client ``` 安装过程中,如果想要更改MySQL的默认安装...

    用PHP+MySQL搭建聊天室

    <meta http-equiv="refresh" content="5;url=cdisplay.php"> $link_ID = mysql_connect("main", "root"); // 连接MySQL服务器 mysql_select_db("abc"); // 选择数据库 $str = "SELECT * FROM chat ORDER BY...

    MySQL Workbench使用教程.docx

    MySQL Workbench是一款强大的数据库设计和管理工具,专为MySQL数据库管理员和开发人员设计。它集成了多种功能,如数据库设计、SQL开发以及数据库管理,替代了原有的MySQL Query Browser和MySQL Administrator。这款...

    oauth2密码模式mysql模式

    4. **令牌生成**:如果验证成功,授权服务器会在MySQL数据库中创建或更新相关的访问令牌和刷新令牌(Refresh Token,用于获取新的访问令牌)记录,并返回访问令牌给客户端。 5. **资源访问**:客户端使用获取的访问...

    Centos5.6 x86_64下部署安装DRBD+Heartbeat+MySQL

    # minor-count dialog-refresh disable-ip-verification usage-count no; } common { syncer { rate 30M; } } resource r0 { protocol C; handlers { pri-on-incon-degr "/usr/lib/drbd/notify-pri-on-in...

    MySQL线上常见故障剖析

    - 例如:`pthread_cond_wait`表示线程在等待条件变量,`wait_for_refresh`等函数调用表明可能与刷新表有关。 - **分析原因** - System user执行FLUSH TABLES操作,可能导致其他线程阻塞。 - MySQL主从复制过程中...

    mysql协议详细

    - **COM_REFRESH**:用于刷新服务器状态。 - **COM_SHUTDOWN**:这个命令用于关闭服务器。 - **COM_STATISTICS**:获取服务器统计信息。 - **COM_PROCESS_INFO**:获取正在运行的进程信息。 - **COM_PROCESS_KILL**...

    MYSQL数据库协议详解

    MYSQL数据库协议详解 MYSQL数据库协议是指MYSQL数据库管理系统与客户端应用程序之间的通信协议。该协议定义了客户端与服务器之间的交互过程,包括握手认证阶段、客户端命令请求报文、服务器响应报文等。 数据库...

    Ubuntu 11.10 MySQL客户端Emma 6.0中文乱码解决办法.docx

    please refresh host!\n%s" % (name, "".join(traceback.format_stack())) ``` 修改完成后,重新运行 Emma 6.0 客户端,应当能够正确地显示中文了。 需要注意的是, Emma 6.0 客户端需要连接的数据库也需要使用 ...

    MySQL-Master_Slave_repl.txt

    Refresh permissions mysql> flush privileges mysql> show master status; | File | Position | master-bin.000004 | 120   Slave configuration ==================== Modify the configuration file: ...

    PHP+MYSQL留言本系统

    echo "<meta http-equiv='refresh' content='1;URL=index.php'>"; } else { echo "留言失败!"; } mysql_close($link); ?> ``` - **解释**: - 包含`IncDB.php`文件,确保已建立数据库连接。 - 使用`$_...

    使用Redis 存储AccessToken +使用MySQL 存储ClientDetails和UserDetails信息

    - `client_details`:存储客户端信息,如client_id、client_secret、resource_ids、scope、authorized_grant_types、web_server_redirect_uri、authorities、access_token_validity、refresh_token_validity、...

    prerender-mysql-cache:用于MySQL缓存的Prerender插件

    prerender-mysql-cache...//If you want to updated cache, specify time life in secondsprocess.env.PRERENDER_MYSQL_CACHE_REFRESH_TIME = 24 * 3600;server.use(require('prerender-mysql-cache'));server.start();

    Linux服务器配置方案MySQL(上)

    - **刷新所有表并重写日志文件**:`mysqladmin refresh` 4. **连接与断开MySQL服务器** - **连接服务器**:`mysql -h host -u user -p` - 如果MySQL服务运行在同一台主机上,则可以省略`-h host`参数。 - 需要...

    1、使用Redis存储AccessToken 2、使用MySQL存储ClientDetails和UserDetails信息.zip

    Spring Boot + Spring Security Oauth2 + Mysql + Redis Mysql存储 ClientDetails 和 UserDetails 认证信息 Redis存储 AccessToken、RefreshToken、Authentication 等凭证信息。 spring security 企业级应用安全架构...

    Eloquent-Relationships-Advanced-Laravel-7-and-MySQL:Laravel和MySQL开发软件

    git clone https://github.com/DanielArturoAlejoAlvarez/Eloquent-Relations-Laravel-7-and-MySQL[NAME APP]$ composer install$ copy .env.example .env$ php artisan key:generate$ php artisan migrate:refresh ...

    proxy变量-管理变量

    MySQL 变量的名字以“mysql-”开头,它们控制 ProxySQL 的 MySQL 功能。例如,mysql-default_xxx 变量定义了 MySQL 服务器的默认设置。ProxySQL 能够跟踪客户端连接所需的多个会话变量,并在该客户端连接使用的每个...

    HzBookBack:初期api,eggjs + mysql + sequelize + migration + jwt

    HzBookBack【eggjs + sequelize + mysql】 简单能用的预设api接口,搭配前端【HzBookInfo】 技术栈 框架:eggjs 数据库:mysql ORM:egg-sequelize,mysql2,.../ api / token / refresh更新token 启动 $ npm i $ n

    通过MySQL日志实时查看执行语句以及更新日志的教程

    - `refresh`:与`flush-logs`类似,但某些早期版本的MySQL可能需要此命令。 新的日志文件会自动重命名并增加扩展数字,除非你手动指定了具体文件名。 3. **SQL命令`FLUSH LOGS`**: 在MySQL中,你可以使用SQL...

Global site tag (gtag.js) - Google Analytics