Discover database book principles practice using mysql, include the articles, news, trends, analysis and practical advice about database book principles practice using mysql on alibabacloud.com
For mysql database operations in a good message book, refer to php beginners.Copy codeThe Code is as follows:Class mysql {Var $ querynum = 0;Function connect ($ dbhost, $ dbuser, $ dbpw, $ dbname = '', $ dbcharset = ''){If (! @ Mysql_connect ($ dbhost, $ dbuser, $ dbpw )){$ This-> show ('can not connect to
For mysql database operations in a good message book, refer to php beginners.
Copy codeThe Code is as follows: Class mysql {
Var $ querynum = 0;
Function connect ($ dbhost, $ dbuser, $ dbpw, $ dbname = '', $ dbcharset = ''){
If (! @ Mysql_connect ($ dbhost, $ dbuser, $ dbpw )){
$ This-> show ('can not connect to
I started writing this book for more than 40 days. During this period, many enthusiastic netizens sent very good suggestions and received support from colleagues and friends, the progress is still smooth. Due to various reasons, we decided to suspend the two
I started writing this book for more than 40 days. During this period, many enthusiastic netizens sent very good suggestions and received support from
This article mainly describes the principles of the MySQL database lock mechanism. We all know the version (for example, the technology used to insert data in MySQL in parallel) and can perform write operations, there are also many related read operations. This indicates that the d
table will lose its meaning. The difference between a file system backup and a direct copy file is that you have complete control over the backup process, so you can take steps to ensure that the server keeps the table undisturbed. Mysqldump are slower than direct copies. Mysqldump generates text files that can be ported to other machines, even on machines with different hardware structures. Direct copy files cannot be ported to other machines unless you are copying the tables
Due to the shortage of MySQL resources in China, it is neither too slow nor open to Chinese users. Therefore, in the days without MYSQL, it is more difficult for us to do something that is convenient for others and improve our websites. to get rid of this pain, niky is crying, meditating, and building a car behind closed doors, finally, Huang Tian has no SyntaxHighlighter. all ();
Due to the shortage of
Because the domestic MySQL resources are more tense, foreign is not too slow, is not open to our users. So, in the days without MySQL, we want to do something convenient for others and improve their own site, it is more difficult than heaven, in order to get rid of this pain, niky crying meditation, behind closed doors, and finally, emperor, a person does not need MySQL
Because the domestic MySQL resources are more tense, foreign is not too slow, is not open to our users. So, in the days without MySQL, we want to do something convenient for others and improve their own site, it is more difficult than heaven, in order to get rid of this pain, niky crying meditation, behind closed doors, and finally, emperor, a person does not need MySQL
The message book guestbook. php I wrote using php + mysql:
High school
Include ("connect. rec ");$ Qh = mysql_query ("select count (*) AS rcnt FROM guestbook ");$ Data = mysql_fetch_array ($ qh );$ N
(guaranteed by the program); 4. SQL class principle SQL statement as simple as possible (a SQL can only be in a CPU operation, large statements to remove small statements, reduce lock time, a large SQL can block the entire library); simple transactions; avoid using TRIG/FUNC (triggers, functions not replaced by client programs); no SELECT * (Consumes Cpu,io, memory, bandwidth, this program is not extensible), or is rewritten as in (or is an n-level e
First, the premise
The principle here is only for MySQL database, other database some is the same, some still exist differences. My summary is also the general rule of MySQL, special treatment for some special cases. Develop good habits when constructing SQL statements.
Ii. Summary of
I. Prerequisites
The principle here is only for MySQL databases. Some of the other databases are similar, and some are still different. I have summarized the General Rules of MySQL and have to take special measures in some special cases. Make good habits when constructing SQL statements.
Ii. Summary of principles
Principle 1: only list the fields to be queried
In practice, the libdata1 file of the Zabbix-Server database MySQL is too large.
Today, the root space of our zabbix-server machine is insufficient. I found that the libdata1 file under/var/lib/mysql/is too large, which has reached 41 GB. I immediately thought about the reason for zabbix's
information for "left mercy" 2. Check all product information of price >60 yuan 3. Check the product name contains the "Shi" word of the product information 4. Check all product information for product ID within (3,6,9) range 5. Check the product name contains the "Shi" Word and ID 6 of the product information 6. Query for product information with ID 2 or 6 15. Sorting 16. Aggregation Common function sum () SUM, avg () average, Max () max, min () min, count () count Like what: Selec
Because the domestic MySQL resources are relatively tense, foreign is not too slow, is not open to our users. Therefore, in the days without MySQL, we want to do something convenient for others and improve their site, it is more difficult than the sky, in order to get rid of this pain, niky crying meditation, behind closed doors, finally, Emperor, a simple message that does not need
-level or row-level locking:
· Most of the table statements are used for reading.
· Read and update strict keywords. You can update or delete a row that can be extracted with a single read Keyword:
? UPDATE tbl_name SET column = value WHERE unique_key_col = key_value;
? Delete from tbl_name WHERE unique_key_col = key_value;
· SELECT combines parallel INSERT statements with few UPDATE or DELETE statements.
· There are many scan or group by operations on the entire table without any write operatio
.
· There are many scan or group by operations on the entire table without any write operations.
Different from row-level or page-level locking options:
· Version (for example, the technology used to insert data in MySQL in parallel), which can be a write operation with many read operations at the same time. This indicates that the database tutorial or table supports different views of Data Dependencies, de
This is what I saw on the internet a good MySQL database optimization article, the content is very full!
1, use the index to traverse the table faster
The index established by default is not a clustered index, but sometimes it is not optimal. Under a non-clustered index, data is physically stored randomly on a data page. The reasonable index design should be based on the analysis and prediction of various
This is a good mysql database optimization article I have seen on the Internet. The content is full!
1. Use indexes to traverse tables faster
The index created by default is a non-clustered index, but sometimes it is not optimal. In a non-clustered index, data is physically stored on the data page randomly. Reasonable index design should be based on the analysis and prediction of various queries. Generall
="******", DB="Pydata", port=3306) cur=database.cursor ()Print("#1. Querying the database First") SQL="SELECT * FROM Info"Try: Cur.execute (SQL) Results=Cur.fetchall ()Print("name","ID") forRowinchResults:name=row[0] ID=row[1] Print(Name,id)exceptException as E:RaiseePrint("#2. Inserting Data") Sql_in_name=input ("Please enter the name you want to insert:") sql_in_id=input ("Please enter the ID you want to insert:") Sql_insert=r"INSERT into
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.