SQLServerInsert efficiency (heap table VS clustered index table)

Source: Internet
Author: User
Which of the following is more efficient when SQL Server's Insert operations are performed on heap tables or clustered index tables? Why is it high? Some colleagues have asked me this question before. To ensure the record efficiency of the logstore, I did a simple test. First of all, I should emphasize the following concepts: heap table: for a table without clustered indexes, the IAM page and PFS page are used to determine which page has free space.

Which of the following is more efficient when SQL Server's Insert operations are performed on heap tables or clustered index tables? Why is it high? Some colleagues have asked me this question before. To ensure the record efficiency of the logstore, I did a simple test. First of all, I should emphasize the following concepts: heap table: for a table without clustered indexes, the IAM page and PFS page are used to determine which page has free space.

"Which of the following is more efficient for SQL Server Insert operations in heap tables or clustered index tables? Why is it high ?"

Some colleagues have asked me this question before. To ensure the efficiency of the logstore record, I did a simple test. I should first emphasize the following concepts:

Heap table: A table without clustered indexes. On the Hong Kong server, the IAM page and PFS page are recorded to determine which page has free space.

Clustered index table: A table with clustered indexes. records are maintained in the logical order of the key values on the page where the clustered key values are located.

Demo:

Perform five concurrent threads and website space on the heap table and the clustered table respectively. Each thread is inserted 10000 times in a loop.

1. Heap Table Test

Insert_Test (id int identity, name char (200) go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.