10 Python common face questions

1, MySQL index species

1. Normal 2. index 3. index unique primary key index 5. 4. A composition full-text index Index

2, follow the rules leftmost index prefix under what circumstances?

The most left-prefix part of the principle, the index index1: (a, b, c), only take a, a, b, a, b, c three types of queries, in fact, have a little problem here that, a, c also go, but just take a field index, will not go c field.

Index is ordered, arranged index1 index in an index file is ordered, according to a first sort, then is sorted according to b, are ordered according to C and finally,

3, the difference between primary keys and foreign keys?

Primary key: uniquely identifies a record, can not be duplicated, NOT NULL

Foreign Key: foreign key table is the primary key of another table, there may be repeated foreign key may be null

4, MySQL common function?

sum 、 count 、 abs...

5, the index of name did the only premise, outlined the following differences:

A: filtered data at the same time, counting

6,1000w of data, the use of limit offset page, why the slow climb back? How to solve?

A: First check the primary key in paging. select * from tb where id in (select id from tb where limit 10 offset 20)

7. What is the index of the merger?

A: Index merge, so that one can use multiple sql index. These indexes on the intersection, union, or take the first set and then take the intersection. Thereby reducing the number of data taken from the data table, to improve the search efficiency.

8, what is covered by the index?

A: If an index comprising (or covering) the values ​​of all fields need to query, called 'covering index'

9, outlining a database separate read and write?

A: Master master record database operation log to Binary log, turn on i / o threads from the server to the operation of the binary log synchronized to the relay log (present from the cache server), additionally sql thread will operate relay log logging execution from the server. 

10, briefly database sub-library sub-table? (Horizontal and vertical)

A: (1) sub-table database

    The one table into different tables entities according to certain rules. Such vertical division and the horizontal division

  Vertical segmentation: the different functions of different modules each data table into different, but if the data module is too large will be the same performance bottleneck

Segmentation horizontal: vertical segmentation can not solve the bottleneck of a large table, if the data is too large the same function table, the table must be segmented, segmentation horizontal

Popular understood: vertical segmentation --- divided into different modules table; --- segmentation level in multiple tables under the same module

(2) sub-libraries

The pile of data into different databases stored in the above said are on the same database, points are assigned to the library on a different database

Guess you like

Origin www.cnblogs.com/xxpythonxx/p/11234135.html
Recommended