SELECT INTO syntax, missing index

SELECT INTO syntax is often used in our development process such as:

SELECT  *  INTO  Table_B  FROM  Table_A

The generated new table Table_B does not contain the primary key and index in Table_A. If you encounter the query timeout problem, you can first check whether the code contains the SELECT INTO operation

, and re-increase the index

/* Add the primary key, there will be a clustered index on the primary key by default */
ALTER TABLE table name ADD CONSTRAINT primary key name PRIMARY KEY (column name)
/* Add index */ 
CREATE NONCLUSTERED |CLUSTERED INDEX index name ON table name (column name ASC|DESC)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324924327&siteId=291194637