Classic MySQL limit query optimization

The following article is mainly on the MySQL limit query optimization of the specific content, we all know that the MySQL database optimization is very important. The other most common and most desirable optimization is limit. The MySQL limit to paging has brought great convenience, but when the amount of data, limit the performance dropped sharply. The same is to take 10 data select * from yanxue8_visit l ...

Mysql increase the index of the three principles

First, the importance of the index The index is used to quickly find a column in a particular value of the line. Instead of using an index, MySQL must start with the first record and then read the entire table until it finds the relevant row. The larger the table, the more time it takes. If the table in the query column index, MySQL can quickly reach a location to search the middle of the data file, there is no need to see all the data. Note that if you need to access most of the rows, sequential reads are much faster since we avoid disk searches. If you use Xinhua Dictionary to find "Zhang" the Chinese characters, do not use the directory, then ...

MySQL commonly used examples of operator operations

Operator Priority Order Highest Priority: = 1 ||, or, xor 2 &&, and 3 between, case, when, then, else 4 =, <=>,> =,>, <=, <, <> ,! =, is, like, regexp, in 5 | 6 & 7 <<,> ...

Modify the maximum number of mysql connection

Modify the maximum number of connections mysql The maximum number of connections mysql default is 100, the maximum can reach 16384. Setting method: Method 1 / etc path, find the MY.INI file, modify [mysqld] followed by: set-variable = max_connections = 500 Save and exit, restart MYSQL, OK! Method two in the MYSQL running environment, the Executive Set global max_connection ...

Mysql database sql statement commonly used optimization methods

MySQL database sql statement commonly used optimization methods 1. Query optimization, should try to avoid full table scan, should first consider where and order by the columns involved in the establishment of the index. 2. Should be avoided in the where clause on the field null value judgment, otherwise it will cause the engine to abandon the use of indexes and full table scan, such as: select id from t where num is null You can set the default value of num 0, to ensure that Num column table does not null value ...

MySQL database statement optimization principles

1, use the index to traverse the table faster. The index created by default is a non-clustered index, but sometimes it is not optimal. Under non-clustered indexes, the data is physically stored on the data page. Reasonable index design should be based on the analysis and prediction of various inquiries. In general: a. There are a large number of duplicate values, and often range query (>, <,> =, <=) and order by, group by occurred columns, consider the establishment of cluster index; Column, and each column contains duplicate values ​​can be ...

Query PHP and MySQL articles from the Web

PHP + MySQL combination is a common site to build, but how to use PHP to access the MySQL database through the Web? The following from the working principle of Web database architecture to talk about. Query the database from the Web: How the Web Database Schema Works 1. A user's browser makes an HTTP request that requests a specific Web page, where the Departing form is submitted to a php script file (eg, results.php) ; 2, Web server receives the results.php page please ...

MySQL database backup basics

Usually when we use the MySQL database, often because of operational errors caused by data loss, MySQL database backup can help us to avoid due to various reasons, data loss or other problems with the database. First, the data backup shortcut Because this method has not been the official official document validation, we tentatively called the experiment. Purpose: Backup hostA host a MySQL database backup TestA, and restored to the hostB machine in the test environment: Operating System: WinNT4.0, Mysql3.22.34, phpM ...

Use an INSERT statement to complete the multi-table insert

This is a subversion of the conventional method of insertion, an INSERT statement to complete the task of inserting multiple tables. Little showcase this insertion method. 1. Create a table T and initialize the test data, this table as a data source. sec @ ora10g> create table t (x number (10), y varchar2 (10)); sec @ ora10g> insert into t values ​​(1, 'a'); sec @ ora10g ...

Three commonly used methods to modify mysql maximum number of connections

MYSQL Based database installation is complete, the default maximum number of connections is 100, the general flow slightly larger forums or websites this connection is not enough, increase the default MYSQL connection method there are two ways: Enter the MYSQL installation directory Open MYSQL Configuration file my.ini or my.cnf Find max_connections = 100 Modify max_connections = 1000 MYSQL Based services can be restarted Method two: MySQL ...

Whether the MySQL time field uses INT or DateTime

Today found that the deder MYSQL time field, are used `senddata` int (10) unsigned NOT NULL DEFAULT '0'; Then find this article online, it seems that if the time field is involved in the operation, int better, a To retrieve the field without conversion operations, directly for time comparison! Second, the efficiency is higher as described below. In the final analysis: int instead of the data type, more efficient. Environment: Windows XP PHP Versio ...

String Pattern Matching in MySQL

MySQL provides standard SQL pattern matching and a format based on pattern matching of extended regular expressions like Unix utilities such as vi, grep and sed. Standard SQL Pattern Matching SQL pattern matching allows you to match any single character with "_" and "%" with any number of characters (including zero characters). In MySQL, the default SQL mode is case-insensitive. Here are some examples. Note that you can not use = or! = While you are using SQL mode, and use LIKE or NOT LIKE to compare operators ...

How to define foreign key in MySQL

If a computer manufacturer, its database holds machine and accessories product information. The table used to save the whole product information is called pc; the table used to save the parts supply information is called parts. There is a field in the pc table, used to describe the type of CPU used in this computer; there is a field in the parts table, the description of the CPU model, we can think of it as a list of all CPU models. Obviously, the CPU used by this manufacturer must be a model that exists in the supply information sheet. At this time, two tables ...

MYSQL made the last record

In MySQL, using the id field of the auto_increment type as the primary key of a table and using it as a foreign key to other tables to form a "master-slave table structure" is a common usage in database design. However, in the specific generation of id, our order of operations is generally: insert records in the main table, and then get the automatically generated id, based on it to insert the record from the table. There is a difficulty here, is inserted into the main table record, how to get it corresponds to the id. The usual practice is through "select max (id) from table ...

Clarify the meaning of mysql chain and command

Usually speaking of foreign keys, we only mention "the purpose of the foreign key is to determine the referential integrity of the data." However, what foreign keys specifically include the actions and meanings? 1, set the outer chain: (1), create a foreign key through create table: see 2 lines of code is built in the table command: create table city (... key idx_fk_country_id (country_id), constrain ...

mysql bulk load data using the LOAD statement

Earlier in this chapter discussed how to use SQL to insert data into a table. However, if you need to add many records to a table, it is inconvenient to use SQL statements to enter data. Fortunately, MySQL provides methods for bulk data entry, making it easy to add data to the table. This section, as well as the next section, describes these methods. This section describes the SQL language-level workarounds. 1, the basic syntax and syntax: LOAD DATA [LOCAL] INFILE 'file_name.txt' [REPLACE ...

Optimize MySQL statements with ORDER BY by index

Several guidelines on the establishment of the index: 1, a reasonable indexing can speed up the efficiency of data reading, but unreasonable indexing will slow down the database response speed. 2, the more the index, the slower the update data. 3, try to use the index when using MyIsam as an engine (because MySQL uses BTree to store indexes), not InnoDB. But MyISAM does not support Transcation. 4, when your program and database structure / SQL statement has been optimized to the extent that can not be optimized, and the program bottleneck can not be successfully resolved, then ...

Automatic backup of MySQL database and recovery after database corruption

First, the preamble: When the database server is established, we must first do is not to consider in this support for the database server running which are carried by the MySQL program, but when the database is destroyed, how to safely restore to the last normal State, making the loss of data to a minimum. Or just the establishment of the database server, only to show what it can do, does not mean that it can be stable to do something. The efficiency and comprehensiveness of disaster recovery is also a quasi-factor of system stability, especially for a server system. This section introduces the automatic database backup to ...

Total Pages: 4 1 2 3 4 Go to: GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.