Congratulations! There are only a few pages left in front of you, and then you can complete the first month of SQL Server Performance Tuning Training. Today I'm going to talk about some of the limitations on the next page and why you'll love them and why you'll hate them.
As you learned in Week 2, a data page is always 8kb in size, and you can only store 8060 bytes on it. Your record size indicates how many records you can store on a page. When you deal with fixed-length data types such as CHAR, INT, DATETIME, etc., you will find that SQL Server has a limit that the record length cannot exceed 8060 bytes (including 7 bytes of internal row overhead).
Page limit? The good sideWhen your table has fewer than 8 columns, you need to add an additional 7 bytes of internal row overhead (for each record). For every 8 additional columns you add an extra 1 byte, for example, for 17 columns you need 9 btyes of internal row overhead (7 1 1). If you try to create a longer record size, SQL Server will return an error message to you when you execute the CREATE TABLE statement. Let’s take a look at the following table definition:
1 CREATE TABLE TooLargeTable12 (3 Column1 CHAR(5000),4 Column2 CHAR(3000),5 Column3 CHAR(54)6 )7 GO
As you can see, each record requires 8061 bytes (5000 3000 54 7 bytes). So in this case, when you try to create this table, SQL Server will return the following error message.
When you create a table with more than 8 columns, you need to include the 8 bytes of row internal overhead required by SQL Server.
1 CREATE TABLE TooLargeTable22 (3 Column1 CHAR(1000) NOT NULL, Column2 CHAR(1000) NOT NULL,4 Column3 CHAR(1000) NOT NULL, Column4 CHAR(1000) NOT NULL,5 Column5 CHAR(1000) NOT NULL, Column6 CHAR(1000) NOT NULL,6 Column7 CHAR(1000) NOT NULL, Column8 CHAR(1000) NOT NULL,7 Column9 CHAR(53) NOT NULL8 )9 GO
So here is another illegal table definition (8000 53 8 bytes), and SQL Server will return an error message.
Page limits?? The bad sideIn the previous link I have shown you the side of page limits that you like, because when you create such a table, SQL Server will return You got an error message. But page limits also have a nasty side, because SQL Server will allow you to create such a table, and sometimes the INSERT statement will succeed and sometimes it will fail... Let's take a look.
The problem we face here is with variable length data types like VARCHAR. When these columns cannot exist on its own page, SQL Server moves them to row offsets on another page. This is called a Row-Overflow page . SQL Server will leave a 24 bytes long pointer to the row overflow page in the original page.
In some cases when other columns are combined, this pointer will exceed the 8060 bytes limit. Let’s take a look at the following table definition:
1 CREATE TABLE TooLargeTable32 (3 Column1 CHAR(5000),4 Column2 CHAR(3000),5 Column3 CHAR(30),6 Column4 VARCHAR(3000)7 )8 GO
As you can see, here I used the data type of VARCHAR (3000) . You will see that SQL Server will give you a warning message here. This warning indicates that you can create this table, but it may fail when executing the INSERT/UPDATE statement...
The following insert statement in the table will succeed:
1 INSERT INTO TooLargeTable3 VALUES2 (3 REPLICATE('x', 5000),4 REPLICATE('x', 3000),5 REPLICATE('x', 30),6 REPLICATE('x', 19)7 )8 GO
The record size here is 8056 bytes long (5000 3000 30 19 7 bytes). In this case, SQL Server will save the data in column 4 in the main data page. But imagine the following INSERT statement:
1 INSERT INTO TooLargeTable3 VALUES2 (3 REPLICATE('x', 5000),4 REPLICATE('x', 3000),5 REPLICATE('x', 30),6 REPLICATE('x', 3000)7 )8 GO
In the INSERT statement just now, SQL Server will move the 4th column data to the row-overflow page (row-overflow page), because These 3000 bytes cannot be placed in the main data page. This means that SQL Server will leave a 24bytes long pointer to a different page where the data can be found. But our record size is now 8061 bytes long (5000 3000 30 24 7 bytes).
Duang, your record length exceeds 8060 bytes, and the INSERT statement failed to execute!
These are bad restrictions because they are hidden during database operations. The good thing is that when you define The table structure is visible as shown above. Think about it, what is it?
SummaryWhen you design your table structure, you have to think about your operations very carefully. When dealing with pages in SQL Server you will encounter many such limitations that only appear after execution. Of course, when SQL Server gives you an error message, you are not allowed to create this table, and the world is basically at peace.
When you receive a warning, almost everyone ignores it without even thinking about it. This is always a bad move, because as you've seen, your INSERT may fail at runtime, and you can expect the problem to occur. I hope you now understand that this performance tuning training is a good low-down and why it is so important to understand the internal structure of data pages!
In the next training I will explain more details about heap tables in SQL Server, and why they are sometimes good (design) and sometimes bad (design). Please stay tuned and enjoy the remaining 7 days!

HTMLtagsdefinethestructureofawebpage,whileattributesaddfunctionalityanddetails.1)Tagslike,,andoutlinethecontent'splacement.2)Attributessuchassrc,class,andstyleenhancetagsbyspecifyingimagesources,styling,andmore,improvingfunctionalityandappearance.

The future of HTML will develop in a more semantic, functional and modular direction. 1) Semanticization will make the tag describe the content more clearly, improving SEO and barrier-free access. 2) Functionalization will introduce new elements and attributes to meet user needs. 3) Modularity will support component development and improve code reusability.

HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Chinese version
Chinese version, very easy to use

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Atom editor mac version download
The most popular open source editor
