SQL:
CopyCodeThe Code is as follows: select
@ Rownum: = @ rownum + 1 as rownum,
A. order_id,
Case when a. Ordered = 1 then 'split into tickets 'end as ordered,
A. Printed,
A. order_sn,
A. user_id,
B. user_name,
A. consignee,
A. Tel,
A.
1. index creation time: it is worthwhile to create an index for a field in select, filter, and sort conditions.
2. For Fuzzy queries like '% XXX', normal indexes cannot be satisfied, and full-text indexes must be created.
3. if there are
To replace part of a field, use the update statement:
UPDATE table name SET field name = REPLACE (REPLACE the previous field value, 'replace the previous keyword ', 'replace the previous keyword') WHERE field name REGEXP "REPLACE the previous
How can I use a command line to access mysql? I have not seen a friend raise such a question on the Forum recently. Some netizens have also given the answer, and I would like to share it with you here!
A free version of software for converting
Poor Optimization of nested queries
As mentioned above, join table queries are more effective than nested queries without special considerations. Although the two queries share the same meaning, even though your plan is to tell the server what to do
This is the case: there are two tables, team table and people table. Each people belongs to a team and there is a field team_id in people.
The following table creation statement is provided:
Copy codeThe Code is as follows: create table t_team
(
Id
On a PHP page, there is a browser count of 200 concurrent queries per second, which causes a lot of pressure on mysql due to insert.
In the lnmp environment, other page content is cached, and there is not much load. This is the browser statistics
Relational databases depend on primary keys, which are the foundation of the Physical Mode of databases. The primary key has only two purposes on the physical layer:
Uniquely identifies a row.As an object that can be effectively referenced by a
1. if many rows are inserted from the same client at the same time, use the INSERT statement containing multiple values to INSERT several rows at the same time. This is faster than using a single-row INSERT Statement (several times faster in some
The searchd daemon of sphtracing supports MySQL binary network protocol from version 0.9.9-rc2 and can be accessed through standard MySQL APIs.For example, the "mysql" command line program can work well.
The following is an example of using the
We know that mysqli is a new MySQL interface provided in PHP 5, which uses the object-oriented idea. The code using the mysqli interface is more readable, and its execution efficiency is higher than that of the mysql interface. In addition, mysqli
Dump is performed at every day to back up the corresponding database, and binlog files of the corresponding database are updated.If a database error is found, you only need to recover the previous dump backup and then restore the binlog file of the
1. Introduction
In the Web application architecture, the data persistence layer (usually a relational database) is a key core component and has a very important impact on the system performance. MySQL is currently the most widely used open-source
Perform a detailed analysis on mysql Query Cache from five perspectives: Query Cache working principle, how to configure, how to maintain, how to determine the Query Cache performance, and suitable business scenario analysis.
Working Principle
The
1. query help? Contents2. Use the merged hash value to separate BLOB or TEXT3. Number of points used for currency (decimal or numberic)4. SQL _mode?5. order by rand () limit 1000;6. Optimize show status like 'com' Com_select Com_insert and so on to
I. concept:
① Database Synchronization (master-slave synchronization-write data to the slave server while writing data to the master database)② Database Synchronization (master-master synchronization-two database servers write data to each other)
Ii.
Environment
MySQL 5.1 + command line tool
Problem
MySQL table field settings Default Value
Solution
Copy codeThe Code is as follows: -- SQL:
Create table test (
I _a int NOT NULL DEFAULT 1,
Ts_ B timestamp NOT NULL DEFAULT NOW (),
C_c char (2)
If the database in use suddenly has some class problems
Run the following command in Linux. Of course, you need to find your mysql directory.
LinuxCopy codeThe Code is as follows:/usr/local/mysql/bin/mysqladmin-u root-p flush-tables
WindowsRun lush-
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