zoukankan      html  css  js  c++  java
  • mysql之分页与慢日志以及表知识补充

    1.分页.
    select * from tb1 limit 100000000,10;
    提高分页的速率:
    加上条件:使它跳过 100000000 条
    如:将当前页的最后的nid 用全局变量记录(下一页)
    将当前页的第一个nid 用全局变量记录(上一页)
    2.慢日志
    默认情况下,mysql的慢日志功能是关闭的
    如果要启用,要去内存中开启
    mysql> show variables like '%query%';
    +------------------------------+----------------------------------------------------------------+
    | Variable_name | Value |
    +------------------------------+----------------------------------------------------------------+
    | binlog_rows_query_log_events | OFF |
    | ft_query_expansion_limit | 20 |
    | have_query_cache | NO |
    | long_query_time | 10.000000 |
    | query_alloc_block_size | 8192 |
    | query_prealloc_size | 8192 |
    | slow_query_log | OFF |
    | slow_query_log_file | D:mysql_lovmysql-8.0.19-winx64dataDESKTOP-4FRVIM6-slow.log |
    +------------------------------+----------------------------------------------------------------+
    8 rows in set, 1 warning (0.04 sec)

    mysql> set long_query_time=3;
    Query OK, 0 rows affected (0.00 sec)

    mysql> show variables like '%query%';
    +------------------------------+----------------------------------------------------------------+
    | Variable_name | Value |
    +------------------------------+----------------------------------------------------------------+
    | binlog_rows_query_log_events | OFF |
    | ft_query_expansion_limit | 20 |
    | have_query_cache | NO |
    | long_query_time | 3.000000 |
    | query_alloc_block_size | 8192 |
    | query_prealloc_size | 8192 |
    | slow_query_log | OFF |
    | slow_query_log_file | D:mysql_lovmysql-8.0.19-winx64dataDESKTOP-4FRVIM6-slow.log |
    +------------------------------+----------------------------------------------------------------+
    8 rows in set, 1 warning (0.00 sec)

    3.表增加,删除,修改 列
    3.1.给一个表添加列:---  alter table 表名 add 列名 列类型;
    mysql> alter table tb3 add num int;
    Query OK, 0 rows affected (0.02 sec)
    Records: 0 Duplicates: 0 Warnings: 0
    3.2.删除一列: --- alter table 表名 drop column 列名;
    mysql> alter table tb3 drop column num;
    Query OK, 0 rows affected (0.04 sec)
    Records: 0 Duplicates: 0 Warnings: 0
    3.3.修改列 :alter table 表名 modify 列名 列类型;
    mysql> alter table tb3 add child char(255);
    Query OK, 0 rows affected (0.02 sec)
    Records: 0 Duplicates: 0 Warnings: 0
    修改如下:
    mysql> alter table tb3 modify child varchar(255);
    Query OK, 0 rows affected (0.05 sec)
    Records: 0 Duplicates: 0 Warnings: 0
  • 相关阅读:
    famous javascript library.
    54陈上有一些技术文章
    codeforces 612A The Text Splitting(扩展欧几里得)
    UVA 11235 Frequent values
    codeforces 604A Uncowed Forces
    nyoj 138 找球号(二)
    codeforces 592A PawnChess
    cidefirces Educational Codeforces Round 2 A. Extract Numbers
    cidefirces Educational Codeforces Round 2 B Queries about less or equal elements
    codeforces Educational Codeforces Round 2 C Make Palindrome
  • 原文地址:https://www.cnblogs.com/startl/p/12491420.html
Copyright © 2011-2022 走看看