Fill This Form To Receive Instant Help
Homework answers / question archive / Experiment 4: View and Index Goal 1
1. Be familiar with the use of GUI and SQL language to create, update and delete views.
2. Proficient in creating and deleting index using GUI and SQL language.
3. Understand and verify the role of index.
Hint:
Hint: Only when the created view can be resoluted, it can be deleted normally, otherwise it will fail to be deleted.
(1) Create a non-unique index named IX_CNAME on the CNAME attribute of table C.
(2) Create a composite index named IX_ngd_NGD on the table S, which is an ascending index for sname, sgender and sdept attribute sets.
Hint: you can use show index from table name to view the index information on the table.
(3) Delete index IX_ CNo of table C?
(4) Based on the above indexes (table C: primary key index of CNO, general index of CNAME; table S: primary key index of SNO, IX_ NGA composite index), use explain statement to obtain the query plan of each query statement, to observe the index usage in each query statement.
(
user_id int primary key, //USER ID
username varchar(10), //USERNAME
gender char(1), //GENDER
age int, //AGE
c_id int //NO OF COLLEGE
)
(1) Verify the efficiency difference between indexed and non-indexed queries.
(2) Verify the query efficiency of single field narrow index and multi field wide index, pay attention to understand the left most matching principle in wide index.
(3) Verify the difference of query efficiency between clustered index (primary key index) and secondary index: build clustered index and nonclustered index on the same field to compare query efficiency. (optional)
(4) At present, only memory engine of MySQL supports both b-tree index and hash index. Create a basic table based on memory storage engine in mysql, and verify the query efficiency difference between b-tree index and hash index based on this table. (optional)
Tips and requirements:
(1) Import a large amount of data (at least 100millio tuples) for validation.
(2) Use the explain command to analyze whether the SQL query uses the created index, and then analyze the performance reasons based on it.
(3) Generally, b-tree index is suitable for range query and hash index is suitable for point query.
Optional experiments
4. Refer to the "gaussdb (for MySQL) database maintenance and management manual.docx", and understand the following functions on the DAS side of Huawei cloud database:
(1) Section 1.2 manages the database cluster.
Special attention: this section of the experiment only to view the operation! Adding cluster nodes, changing cluster specifications, resetting administrator account name and password, cluster backup and recovery, parameter modification and other changes that have an impact on the global situation are only try to understand, not do the actual operations.
(2) 1.3.1 performance monitoring.
(3) 1.3.2 performance tuning.