{"id":211,"date":"2012-01-05T00:00:38","date_gmt":"2012-01-05T00:00:38","guid":{"rendered":"http:\/\/www.sqlserver.fr\/blog\/?p=211"},"modified":"2026-05-02T14:31:18","modified_gmt":"2026-05-02T12:31:18","slug":"stockage-des-donnees-et-index-partie-1-heap","status":"publish","type":"post","link":"https:\/\/www.sqlserver.fr\/blog\/stockage-des-donnees-et-index-partie-1-heap\/","title":{"rendered":"Stockage des donn\u00e9es et index &#8211; Partie 1 : Heap"},"content":{"rendered":"<p>Parmi les fondamentaux de SQL Server figure la notion d\u2019Index Clustered, souvent mal comprise par les d\u00e9butants. Avant de d\u00e9tailler dans un prochain billet cette notion d\u2019index clustered, nous allons d\u2019abord nous attacher \u00e0 d\u00e9crire le stockage des donn\u00e9es dans le cas o\u00f9 une table ne contient pas d\u2019index clustered.<!--more--><\/p>\n<p>Avant toute chose, un des points cl\u00e9 de SQL Server r\u00e9side dans l\u2019unit\u00e9 de stockage, \u00e0 savoir la Page. Une page est de mani\u00e8re invariable un bloc de 8Ko de donn\u00e9es. Au niveau des fichiers de donn\u00e9es, tout est d\u00e9coup\u00e9 sous forme de pages, y compris des pages permettant de d\u00e9crire le r\u00f4le de chaque page (Allocation Maps). Mais n\u2019allons pas trop loin ici, et revenons sur le c\u0153ur du sujet.<br \/>\nLes donn\u00e9es sont stock\u00e9es dans ces pages de 8Ko. Deux formats de stockage sont possibles :<\/p>\n<p style=\"padding-left: 30px;\">&#8211; Soit les donn\u00e9es sont tri\u00e9es d\u2019apr\u00e8s un index clustered (ce point fera l\u2019objet d\u2019un prochain billet)<br \/>\n&#8211; Soit les donn\u00e9es sont positionn\u00e9es \u00e0 la suite les unes des autres, telles qu\u2019elles viennent. On parle alors de \u00ab segment de donn\u00e9es \u00bb, et c\u2019est le comportement par d\u00e9faut d\u2019une table lorsqu\u2019il n\u2019y a pas d\u2019index clustered d\u00e9fini.<\/p>\n<p>Voici les principes de fonctionnement d\u2019un segment de donn\u00e9es (Heap).<\/p>\n<p style=\"padding-left: 30px;\">&#8211; Lorsqu\u2019une nouvelle ligne de donn\u00e9es est ins\u00e9r\u00e9e, elle se positionne \u00e0 la fin.<br \/>\n&#8211; Lorsqu\u2019une ligne de donn\u00e9es est supprim\u00e9e, l\u2019espace qu\u2019elle occupait est d\u00e9clar\u00e9 vacant.<br \/>\n&#8211; Lors de la modification d\u2019une ligne, si l\u2019espace n\u00e9cessaire pour son stockage n\u2019augmente pas, ou s\u2019il y a suffisamment d\u2019espace disponible pour stocker la nouvelle ligne sans d\u00e9placement, alors les donn\u00e9es sont mises \u00e0 jour sur place. Si la ligne \u00ab grossit trop \u00bb, alors elle est d\u00e9plac\u00e9e en fin de liste.<\/p>\n<p>Voici par exemple une table d\u00e9finie sans index clustered.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\">create table TableHeap (Id bigint identity, Donnee1 varchar(500), Donnee2 varchar(500))\r\n\r\ninsert into TableHeap (Donnee1,Donnee2)\r\nvalues ('Court1A','Court2A'),\r\n\t\t('Court1X','Court2X'),\r\n\t\t('Court1B','Court2B'),\r\n\t\t('Court1C','Court2C'),\r\n\t\t('Court1Z','Court2Z')<\/pre>\n<p>Voici le d\u00e9tail du stockage dans la seule page qu\u2019occupent les 4 lignes ins\u00e9r\u00e9es :<\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 0 Offset 0x60 Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x000000005BC8A060<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 01000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 72743141 436f7572 743241 .Court1ACourt2A<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 0 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 1<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 0 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1A<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 0 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2A<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 1 Offset 0x83 Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x000000005BC8A083<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 02000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 72743158 436f7572 743258 .Court1XCourt2X<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 1 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 2<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 1 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1X<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 1 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2X<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 2 Offset 0xa6 Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x000000005BC8A0A6<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 03000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 72743142 436f7572 743242 .Court1BCourt2B<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 2 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 3<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 2 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1B<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 2 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2B<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 3 Offset 0xc9 Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x000000005BC8A0C9<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 04000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 72743142 436f7572 743242 .Court1BCourt2B<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 3 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 4<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 3 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1B<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 3 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2B<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 4 Offset 0xec Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x000000005BC8A0EC<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 05000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 7274315a 436f7572 74325a .Court1ZCourt2Z<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 4 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 5<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 4 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1Z<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 4 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2Z<\/span><br \/>\n<span style=\"font-size: small;\">Lorsque l\u2019on supprime l\u2019enregistrement portant l\u2019Id 3, on constate l\u2019\u00e9volution du contenu de la page : le Slot 2, qui contenait cet enregistrement, a simplement disparu, et les offsets de stockage des autres slots sont rest\u00e9s inchang\u00e9s.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\">delete from TableHeap where id=3<\/pre>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 0 Offset 0x60 Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000057FEA060<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 01000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 72743141 436f7572 743241 .Court1ACourt2A<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 0 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 1<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 0 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1A<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 0 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2A<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 1 Offset 0x83 Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000057FEA083<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 02000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 72743158 436f7572 743258 .Court1XCourt2X<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 1 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 2<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 1 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1X<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 1 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2X<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 3 Offset 0xc9 Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000057FEA0C9<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 04000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 72743142 436f7572 743242 .Court1BCourt2B<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 3 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 4<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 3 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1B<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 3 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2B<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 4 Offset 0xec Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000057FEA0EC<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 05000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 7274315a 436f7572 74325a .Court1ZCourt2Z<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 4 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 5<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 4 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1Z<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 4 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2Z<\/span><\/p>\n<p><span style=\"font-size: small;\">Si l\u2019on met \u00e0 jour un enregistrement, mais que la ligne est trop longue pour rentrer dans l\u2019espace disponible, on voit que la ligne se positionne \u00e0 la suite des autres enregistrements, \u00e0 la fin (le num\u00e9ro de slot 1 est certes conserv\u00e9, mais l\u2019offset est bien sup\u00e9rieur \u00e0 celui du dernier slot, le slot 3).<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\">update TableHeap\r\nset Donnee1='Nouvelle valeur (trop longue pour rentrer dans l''espace disponible) N\u00b01',\r\n\tDonnee2='Nouvelle valeur (trop longue pour rentrer dans l''espace disponible) N\u00b02'\r\nwhere Id=2<\/pre>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 0 Offset 0x60 Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000059B2A060<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 01000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 72743141 436f7572 743241 .Court1ACourt2A<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 0 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 1<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 0 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1A<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 0 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2A<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 1 Offset 0x10f Length 163<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 163 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000059B2A10F<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 02000000 00000000 03000002 005c00a3 0&#8230;&#8230;&#8230;&#8230;&#8230;.\\.\u00a3<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 004e6f75 76656c6c 65207661 6c657572 20287472 .Nouvelle valeur (tr<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000028: 6f70206c 6f6e6775 6520706f 75722072 656e7472 op longue pour rentr<\/span><br \/>\n<span style=\"font-size: x-small;\">000000000000003C: 65722064 616e7320 6c276573 70616365 20646973 er dans l&rsquo;espace dis<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000050: 706f6e69 626c6529 204eb031 4e6f7576 656c6c65 ponible) N\u00b01Nouvelle<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000064: 2076616c 65757220 2874726f 70206c6f 6e677565 valeur (trop longue<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000078: 20706f75 72207265 6e747265 72206461 6e73206c pour rentrer dans l<\/span><br \/>\n<span style=\"font-size: x-small;\">000000000000008C: 27657370 61636520 64697370 6f6e6962 6c652920 &lsquo;espace disponible) <\/span><br \/>\n<span style=\"font-size: x-small;\">00000000000000A0: 4eb032 N\u00b02<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 1 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 2<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 1 Column 2 Offset 0x15 Length 71 Length (physical) 71<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Nouvelle valeur (trop longue pour rentrer dans l\u00a0\u00bbespace disponible) N\u00b01<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 1 Column 3 Offset 0x5c Length 71 Length (physical) 71<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Nouvelle valeur (trop longue pour rentrer dans l\u00a0\u00bbespace disponible) N\u00b02<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 3 Offset 0xc9 Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000059B2A0C9<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 04000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 72743142 436f7572 743242 .Court1BCourt2B<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 3 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 4<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 3 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1B<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 3 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2B<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 4 Offset 0xec Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000059B2A0EC<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 05000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 7274315a 436f7572 74325a .Court1ZCourt2Z<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 4 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 5<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 4 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1Z<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 4 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2Z<\/span><\/p>\n<p><span style=\"font-size: small;\">Si enfin on ins\u00e8re un nouvel enregistrement, on voit que la ligne se positionne \u00e0 la suite des autres enregistrements, \u00e0 la fin (le num\u00e9ro de slot 2 est certes r\u00e9cup\u00e9r\u00e9, mais l\u2019offset est bien sup\u00e9rieur \u00e0 celui du slot 2, celui qui a l\u2019offset le plus important).<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\">insert into TableHeap (Donnee1,Donnee2)\r\nvalues ('Nouvelles donn\u00e9es N\u00b01','Nouvelles donn\u00e9es N\u00b02')<\/pre>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 0 Offset 0x60 Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000059B2A060<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 01000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 72743141 436f7572 743241 .Court1ACourt2A<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 0 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 1<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 0 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1A<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 0 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2A<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 1 Offset 0x10f Length 163<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 163 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000059B2A10F<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 02000000 00000000 03000002 005c00a3 0&#8230;&#8230;&#8230;&#8230;&#8230;.\\.\u00a3<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 004e6f75 76656c6c 65207661 6c657572 20287472 .Nouvelle valeur (tr<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000028: 6f70206c 6f6e6775 6520706f 75722072 656e7472 op longue pour rentr<\/span><br \/>\n<span style=\"font-size: x-small;\">000000000000003C: 65722064 616e7320 6c276573 70616365 20646973 er dans l&rsquo;espace dis<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000050: 706f6e69 626c6529 204eb031 4e6f7576 656c6c65 ponible) N\u00b01Nouvelle<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000064: 2076616c 65757220 2874726f 70206c6f 6e677565 valeur (trop longue<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000078: 20706f75 72207265 6e747265 72206461 6e73206c pour rentrer dans l<\/span><br \/>\n<span style=\"font-size: x-small;\">000000000000008C: 27657370 61636520 64697370 6f6e6962 6c652920 &lsquo;espace disponible) <\/span><br \/>\n<span style=\"font-size: x-small;\">00000000000000A0: 4eb032 N\u00b02<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 1 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 2<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 1 Column 2 Offset 0x15 Length 71 Length (physical) 71<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Nouvelle valeur (trop longue pour rentrer dans l\u00a0\u00bbespace disponible) N\u00b01<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 1 Column 3 Offset 0x5c Length 71 Length (physical) 71<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Nouvelle valeur (trop longue pour rentrer dans l\u00a0\u00bbespace disponible) N\u00b02<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 2 Offset 0x1b2 Length 63<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 63 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000059B2A1B2<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 06000000 00000000 03000002 002a003f 0&#8230;&#8230;&#8230;&#8230;&#8230;.*.?<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 004e6f75 76656c6c 65732064 6f6e6ee9 6573204e .Nouvelles donn\u00e9es N<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000028: b0314e6f 7576656c 6c657320 646f6e6e e9657320 \u00b01Nouvelles donn\u00e9es <\/span><br \/>\n<span style=\"font-size: x-small;\">000000000000003C: 4eb032 N\u00b02<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 2 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 6<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 2 Column 2 Offset 0x15 Length 21 Length (physical) 21<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Nouvelles donn\u00e9es N\u00b01<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 2 Column 3 Offset 0x2a Length 21 Length (physical) 21<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Nouvelles donn\u00e9es N\u00b02<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 3 Offset 0xc9 Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000059B2A0C9<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 04000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 72743142 436f7572 743242 .Court1BCourt2B<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 3 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 4<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 3 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1B<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 3 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2B<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Slot 4 Offset 0xec Length 35<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP VARIABLE_COLUMNS<\/span><br \/>\n<span style=\"font-size: x-small;\">Record Size = 35 <\/span><br \/>\n<span style=\"font-size: x-small;\">Memory Dump @0x0000000059B2A0EC<\/span><\/p>\n<p><span style=\"font-size: x-small;\">0000000000000000: 30000c00 05000000 00000000 03000002 001c0023 0&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;#<\/span><br \/>\n<span style=\"font-size: x-small;\">0000000000000014: 00436f75 7274315a 436f7572 74325a .Court1ZCourt2Z<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 4 Column 1 Offset 0x4 Length 8 Length (physical) 8<\/span><\/p>\n<p><span style=\"font-size: x-small; color: #ff0000;\">Id = 5<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 4 Column 2 Offset 0x15 Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee1 = Court1Z<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Slot 4 Column 3 Offset 0x1c Length 7 Length (physical) 7<\/span><\/p>\n<p><span style=\"font-size: x-small;\">Donnee2 = Court2Z<\/span><\/p>\n<p><span style=\"font-size: small;\">Du point de vue de l\u2019usage, les segments de donn\u00e9es (Heap) ne sont pas pr\u00e9conis\u00e9s, car toute requ\u00eate dans une table de la sorte, \u00ab non-organis\u00e9e \u00bb, oblige un parcours syst\u00e9matique de l\u2019ensemble des lignes pour extraire au vol celles qui correspondent aux crit\u00e8res de recherche.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\">select * from TableHeap where Id=4<\/pre>\n<p><span style=\"font-size: xx-small;\"><a href=\"https:\/\/www.sqlserver.fr\/blog\/wp-content\/uploads\/2012\/03\/image001.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-213\" title=\"Plan\" alt=\"\" src=\"https:\/\/www.sqlserver.fr\/blog\/wp-content\/uploads\/2012\/03\/image001.png\" width=\"414\" height=\"116\" srcset=\"https:\/\/www.sqlserver.fr\/blog\/wp-content\/uploads\/2012\/03\/image001.png 414w, https:\/\/www.sqlserver.fr\/blog\/wp-content\/uploads\/2012\/03\/image001-300x84.png 300w\" sizes=\"auto, (max-width: 414px) 100vw, 414px\" \/><\/a> <\/span><span style=\"font-size: small;\">Bien entendu, lorsque nous n\u2019avons qu\u2019une poign\u00e9e d\u2019enregistrements, un parcours complet de la table n\u2019a qu\u2019un co\u00fbt limit\u00e9. Nous verrons dans un prochain billet que ce co\u00fbt est loin d\u2019\u00eatre n\u00e9gligeable lorsque le volume de donn\u00e9es augmente\u2026<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Parmi les fondamentaux de SQL Server figure la notion d\u2019Index Clustered, souvent mal comprise par les d\u00e9butants. Avant de d\u00e9tailler dans un prochain billet cette notion d\u2019index clustered, nous allons d\u2019abord nous attacher \u00e0 d\u00e9crire le stockage des donn\u00e9es dans &hellip; <a href=\"https:\/\/www.sqlserver.fr\/blog\/stockage-des-donnees-et-index-partie-1-heap\/\">Continuer la lecture <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-211","post","type-post","status-publish","format-standard","hentry","category-article_sql"],"_links":{"self":[{"href":"https:\/\/www.sqlserver.fr\/blog\/wp-json\/wp\/v2\/posts\/211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlserver.fr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlserver.fr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlserver.fr\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlserver.fr\/blog\/wp-json\/wp\/v2\/comments?post=211"}],"version-history":[{"count":8,"href":"https:\/\/www.sqlserver.fr\/blog\/wp-json\/wp\/v2\/posts\/211\/revisions"}],"predecessor-version":[{"id":1961,"href":"https:\/\/www.sqlserver.fr\/blog\/wp-json\/wp\/v2\/posts\/211\/revisions\/1961"}],"wp:attachment":[{"href":"https:\/\/www.sqlserver.fr\/blog\/wp-json\/wp\/v2\/media?parent=211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlserver.fr\/blog\/wp-json\/wp\/v2\/categories?post=211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlserver.fr\/blog\/wp-json\/wp\/v2\/tags?post=211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}