MYSQL database data splitting-database/table sharding summary, mysql database sharding
Data storage evolution 1: single database, single table
Single Database, single table is the most common database design. For example, if a use
"The database cannot be deleted because the database is currently in use ".
Exception Handling Summary-database http://www.cnblogs.com/dunitian/p/4522990.html Series
I was worried about this problem when I was just learning the database. I saw it again when I deleted it today. I just recorded it together:
Graphical
One
First you need to define a database interface function that can be saved as a single PHP page
functiondb_connect() {$result = new mysqli('数据库地址', '账号', '密码', '库名');//连接数据库if (!$result) { returnfalse;//连接失败 } return$result;//返回数据库对象}?>
Two
In another PHP page, the first use of the include函数 PHP page contains the above, it is necessary to ensure that the above interface functions can be called correctly
!--? php function
Reasons for inconsistent data
Data redundancy, improper concurrency control, failures, and errors.
Three Paradigms of database
1 First paradigm: Ensure that each column remains atomic
2) Second paradigm: Ensure that each column in the table is related to the primary key
3) Third paradigm: Ensure that each column is directly related to the primary key, not indirectly related
Transaction attributes
A transaction is a unit of concurrent control, a
# # #数据库的创建
Build a project
Test first to see if a new project can run successfully
Create a personcontrary package and establish a person class to implement the Basecolumns excuse, add all the table column names to this class, and declare the final variable
Create a database helper class, override the method, and build a constructor method.
# # #数据库对外的查询1. Copy the compile ' com.facebook.stetho:stetho:1.3.1 ' into the Build (app) and
When restoring a database backup, the following error occurs: Because the database is in use, you cannot obtain exclusive access to the database.
Solution: modify some database names and execute the SQLCodeAnd then restore it immediately.
Use Master
Declare @ Dbname Varchar ( 20 ) Set @ Dbname = ' Dfd_tes
More than 30 mysql database optimization methods, with 10 million-level database records easily solved, mysql database
1. To optimize the query, try to avoid full table scanning. First, consider creating an index on the columns involved in where and order.
2. Try to avoid null value determination on the field in the where clause. Otherwise, the engine will disca
into' Student 'VALUES('8','Lee 48','123','male',' +','Jingan, Shanghai city'); INSERT into' Student 'VALUES('9','Zhang 39','111','male',' +','Shiyan, Hubei province'); INSERT into' Student 'VALUES('Ten','Lee 40','123','male',' +','Jingan, Shanghai city'); I. Querying 5~10 data MySQL Paging query: SELECT * FROM student limit 5, 10; Oracle Paging query: SELECT * FROM (select *,rownum rn from student) where RN between 6 and 10; SQL Server Paging query: Select Top * from student where ID not
Environment: centos7.2Software: redis-3.2.10 (yum installation)Scenario One: Before the company's Redis does not open aof mode, has been an RDB mode, but the data is very important, the data can not be lost, so need to open aof, but Redis default is to load data from appendonly.aof, Systemctl start Redis, the database is empty because we don't have a appendonly.aof file, and when you close Redis, the Dump.rdb is emptiedScenario Two: Redis
Php:It is usually the beginning of the code you want to check to record a time, the end of the record a time. Take the difference value,the efficiency of database SQLSQL explain (MySQL), enable slow query log to record slow queries. Usually also depends on the database design is reasonable, the demand is reasonable and so on.But this time is generally very fast, in less than a second, so you can not direct
Scenario One: (Don't change too much My.ini file)
Copy the database from the original database a ib_logfile1 ib_logfile0 ibdata1;
Close the destination database B;
Backup destination database b ib_logfile1 ib_logfile0 ibdata1 three files to prevent the database
In the general database configuration file, the connection database is like this, and now the project needs to encrypt the password processing,
So we're going to rewrite the Org.apache.commons.dbcp.BasicDataSource class as follows:
Package com.joyintech.tisaccel.base;Import Org.apache.commons.dbcp.BasicDataSource;public class Teradataconnection extends Basicdatasource {Public Teradataconnection () {TODO aut
Program written on this machine, the database in the company on another computer (sqlserver2008), the machine does not install any database software, the program can connect to the database
Database model (ID-PID): A father has many children, and a child has only one father, such a structure is a tree. In a database table, the ID and PID (parent_id) are designed. A tree is stored by ID and PID.
From the object-oriented design point of view, in the tree node class is not suitable for PID, a node has 1 or 0 fathers, and 0 or children. So the design is as follows: This is an organizational struct
Problem description: After a SQL Server database backup is restored, the word "restricted access" appears after the database nameProblem two description: When restoring to a SQL Server database, Tip: System.Data.SqlClient.SqlError: Because the database is in use, you cannot gain exclusive access to the
In the LAN, the main store summarizes the branch sales and other information by establishing a backup database for the Branch database in the general store database, and then collecting the required information in the database of the branch to be counted.
This tells us that the dat
Most of the important information of the website is kept in the database, the user gets the user information by submitting the Access database. If the database is very fast and helps conserve server resources, in this article, I've collected 10 tips for optimizing database speed.
0. Carefully design the
The difference between spring transaction and database database transaction
When you do not use a transaction, the method that invokes the hibernatetemplate immediately commits the transaction.
And after using the transaction, after you have configured the method of the class to commit the transaction, if a method of multiple inserts, modifications or deletions at the same time
, will be unified to commi
Oracle's commit is to submit the data, before you commit the previous operation, the update is memory, not updated to the physical file.
So you shut down the database without a commit, and the data in the database is not updated. Commit is submitted against: DMLDML (data manipulation Language) requires submission, which is part of data management operations, such as insert (insert), Update (modify), delete
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.