Current location - Loan Platform Complete Network - Big data management - php+mysql in the database if the data is large query is very slow
php+mysql in the database if the data is large query is very slow
1. build index, as far as possible to build the index to you you often compare the field, such as select a,b,c,d from a where index field = value, this index field is preferably numerical data

2. slow there are more cases,

Case 1: remote query, in fact, may query is not slow, due to the large amount of data, the transmission process is slow

Case 2: WHERE too much comparative data behind, such as like class statements

Case 3: need to which field only take that field on the line, such as select * from a and select b,c,d from a speed is a gap

3. database regular maintenance, compression, the data is not commonly used after the backup Put into the backup library, query when checking the backup library, etc.

Questions to add:

. The first: create an index, how to create, I have also heard of, but do not know how to use

Answer: there are differences in the method of creating an index for each type of data, such as SQL SERVER 2000 can be indexed on multiple fields, such as SQL SERVER 2000 there is the command

CREATE INDEX

for a given table or view to create an index for a given table or view.

Only the owner of a table or view can create an index for a table. The owner of a table or view can create an index at any time, whether or not there is data in the table. You can create an index for a table or view in another database by specifying a qualified database name.

Syntax

CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name

ON { table | view } ( column [ ASC | DESC ] [ ,.... .n ] )

[ WITH < index_option > [ ,... .n] ]

[ ON filegroup ]

< index_option > ::=

{ PAD_INDEX |

FILLFACTOR = fillfactor |

IGNORE_DUP_KEY |

DROP_EXISTING |

STATISTICS_NORECOMPUTE |

SORT_IN_TEMPDB

}

Third: regular maintenance of the database, compression: how to compress? Timely backup data to the backup library query backup library, that query is not still slow?

Answer: this has a compression tool, basically each database has its own compression database tools