onfirのブログ -37ページ目

onfirのブログ

ブログの説明を入力します。

There are rows index is used to quickly identify a specific value in a column, do not use an index, the database must begin to read the entire table from the first record until you find the relevant line. The larger the table, Michael Kors Handbags the more time it takes to query the data columns in a query if the table has an index, the database can quickly reach a position to search for data, This part describes the correlation with the index of the contents, including an index of the meaning and characteristics Design Principles index classification, indexing, and how to create and delete indexes. A: index of meaning and characteristics of the index is a single data structure stored on disk, which contains the list of all the recorded data reference pointer, use the index to quickly find out in one or more columns Line a certain value, the use of indexes on the relevant columns is the best way to reduce query Michael Kors Bedford & Astor time. The index contains the table or view or a column of generated keys. For example: there are 20,000 records in the database, and now Michael Kors Hot Sale you want to execute a query: SELECT * FROM tableName WHERE num = 10000. If there is no index, you must traverse the entire table until num = 10000 stop this behavior; num If you create an index on a column, SQL Server does not require any scan, looking directly in an index which 10,000 can learn the location of the line. Visible, indexing can accelerate query speed data. The main advantage of the index were the following: (1) by creating a unique index, you can guarantee the uniqueness of each row of a database table data. (2) can greatly speed up queries data, which is the main reason the index was created. (3) implement referential integrity of the data, the connection speed between the table and the table can be. (4) When using the grouping and sorting clause query, can significantly reduce the query time grouping and sorting. At the same time, increasing the index also has a downside: (1) Create and maintain indexes index takes time and increases the amount of data will increase the time it takes. (2) The index needs to occupy disk space, in addition to the data table space outside accounting data, each index also occupy some physical space, if there are a large number of the index, the index file may reach bigger files faster than the data file size. (3) When the data table to add, delete and modify, when the index also dynamically maintain, thus lowering the data maintenance speed. Top two: index classification in different databases provide different index types, SQL Server in the index, there are two: the clustered index and non-clustered indexes. Their difference is in physical data storage. 1. clustered index clustered index key based on the data rows in the table to sort and store the data rows. Each table can have only one clustered index, because the data line itself can only be a sequential storage. (1) Each table can have only one clustered index; (2) the table in physical order and physical order of rows in the index is the same, we must first create a clustered index before creating any nonclustered indexes, since nonclustered. index changes the physical order of rows in a table; (3) the uniqueness of the key values ​​explicitly using the UNIQUE keyword or maintained by a unique identifier inside. (4) In the process of creating the index, SQL Server temporary database using the current disk space, so make sure there is enough space to create the index. 2. The non-clustered index of non-clustered indexes with completely independent of the data structure of the line, do not use non-clustered index data pages in physical data sorted by column, non-clustered index contains the index key values ​​and pointers to the table data storage location row locator ʱ?? You can create multiple non-clustered index on the table or indexed view. Typically, non-clustered index is designed to improve the frequently used not established clustered index query performance. The query optimizer when searching for data values, first search for a non-clustered index to find the value of the position data in the table, and then directly to retrieve data from that location. This allows non-clustered index to become an exact match queries the best choice, because the index contains the item data value to search the exact location in the table. Query has the following characteristics may consider Christmas Angles iPhone 5 5S Cases using non-clustered index: (1) use JOIN or GROUP BY clause, create more non-clustered index to a column connection and grouping operations involved, create a clustered index any foreign keys . (2) contains a number of unique field values. (3) the query does not return large result sets. Creating a Michael Kors Designer filtered index to cover the return from a large table perfect definition row subquery set. (4) often contains a column in the query search criteria (such as return to exactly match the WHERE clause) in. 3. Other index in addition to the clustered index and non-clustered index outside, SQL Server also provides additional index types. Unique index: ensure that the index key does not contain duplicate values, therefore, the table or view each row is somewhat unique. Clustered index and non-clustered indexes may be Michael Kors Christmas Cases unique index. This uniqueness and primary key constraint is associated, Christmas Beauty iPhone 5 5S Cases in part, the uniqueness of the primary key constraint equal clustered index. Contains the column Christmas Angles iPhone 4 4S Cases index: A non-clustered index, after it extended not only includes the key columns, the column also contains non-kin. Index view: On the View can improve query efficiency view after adding an index. Indexed view will materialized views in a unique clustered index, and the same result set and permanently stored in the storage mode, after you create a clustered index, you can add non-clustered index on the view. Full-text indexing: a special type of function-based index mark by Michael Kors Accessories SQL Server full-text engine to generate and maintain, to help search for the string data in complex words, this index is a clustered index structure used by the database engine or clustered index B-tree structure is different. Space Index: An index for the geometry data type of the column to establish, so you can be more efficient column space objects to perform certain actions, spatial index may need to be applied to reduce the number of objects relatively costly spatial operations. Screening Index: an optimized non-clustered index, especially for covering centralized select data from a well-defined data sub-queries. Filtered index predicate to use the filter portion Michael Kors Satchels of the table index, compared with full-table indexes, well-designed filtered index can improve query performance, reduce index maintenance costs and reduce storage costs index XML index: is associated with XML data index form, is XML binary large object (BLOB) has split lasting representation, XML index can be divided into the main index and secondary index. Three: Design Principles index index index will be poorly designed or lack of performance database and applications obstacle, efficient indexing to get good performance is very important. Design index, you should consider the following guidelines: (1) the index is not possible, in a table if a large number of indexes, not only take up a lot of disk space and can affect performance INSERT, DELETE, UPDATE, etc. statement. Because when the data changes while the table, the index will be adjusted and updated. (2) Avoid too frequently updated table index, and the index of the column as little as possible. While the Michael Kors Clutches field is often used to query should create an index, but to avoid adding unnecessary fields. (3) a small amount of data tables is best not to use the index, due to less data, the time it takes the query may be even shorter than the time to traverse the index, the index may not produce optimal results. (4) In the conditional expression often used, different values ​​on more column is indexed, not to create an index on fewer columns of different values, such as on the student table field [gender] only [M] or [female] two different values, so there is no need to Cheap Michael Kors index, if indexed, not only does not improve query efficiency, it will seriously reduce the update speed. (5) When the Michael Kors Hamilton uniqueness of the data itself is some kind of feature, specify a unique index, the only index to use to ensure data integrity Christmas Beauty iPhone 4 4S Cases column's definition, improve query speed. (6) In the frequent sort or group (namely, GROUP BY or ORDER BY operations) of the Michael Kors New Arrivals column is indexed, if there are multiple columns to be sorted, you can create a composite index on these columns. Four: Create an index in the understanding of the different index types, the following describes how to start using T_SQL create an index: