- Notifications
You must be signed in to change notification settings - Fork5
Commit5f6f840
committed
Reduce the alignment requirement of type "name" from int to char, and arrange
to suppress zero-padding of "name" entries in indexes.The alignment change is unlikely to save any space, but it is really neededanyway to make the world safe for our widespread practice of passing plainold C strings to functions that are declared as taking Name. In the previouscoding, the C compiler was entitled to assume that a Name pointer wasword-aligned; but we were failing to guarantee that. I think the reasonwe'd not seen failures is that usually the only thing that gets done withsuch a pointer is strcmp(), which is hard to optimize in a way that exploitsword-alignment. Still, some enterprising compiler guy will probably thinkof a way eventually, or we might change our code in a way that exposesmore-obvious optimization opportunities.The padding change is accomplished in one-liner fashion by declaring the"name" index opclasses to use storage type "cstring" in pg_opclass.h.Normally btree and hash don't allow a nondefault storage type, because theydon't have any provisions for converting the input datum to another type.However, because name and cstring are effectively the same thing except forpadding, no conversion is needed --- we only need index_form_tuple() to treatthe datum as being cstring not name, and this is sufficient. This seems tomake for about a one-third reduction in the typical sizes of system catalogindexes that involve "name" columns, of which we have many.These two changes are only weakly related, but the alignment change makesme feel safer that the padding change won't introduce problems, so I'mcommitting them together.1 parent3dc59be commit5f6f840
File tree
8 files changed
+34
-31
lines changed- src
- backend
- bootstrap
- utils/adt
- include
- catalog
8 files changed
+34
-31
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
125 | 125 |
| |
126 | 126 |
| |
127 | 127 |
| |
128 |
| - | |
| 128 | + | |
129 | 129 |
| |
130 | 130 |
| |
131 | 131 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
17 |
| - | |
| 17 | + | |
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
| |||
315 | 315 |
| |
316 | 316 |
| |
317 | 317 |
| |
318 |
| - | |
| 318 | + | |
319 | 319 |
| |
320 | 320 |
| |
321 | 321 |
|
Lines changed: 4 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
15 |
| - | |
| 15 | + | |
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
| |||
442 | 442 |
| |
443 | 443 |
| |
444 | 444 |
| |
445 |
| - | |
446 |
| - | |
447 |
| - | |
448 |
| - | |
449 |
| - | |
| 445 | + | |
| 446 | + | |
450 | 447 |
| |
451 |
| - | |
| 448 | + | |
452 | 449 |
| |
453 | 450 |
| |
454 |
| - | |
455 | 451 |
| |
456 | 452 |
| |
457 | 453 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
40 |
| - | |
| 40 | + | |
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
| 56 | + | |
57 | 57 |
| |
58 | 58 |
|
Lines changed: 9 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
217 | 217 |
| |
218 | 218 |
| |
219 | 219 |
| |
220 |
| - | |
| 220 | + | |
221 | 221 |
| |
222 | 222 |
| |
223 | 223 |
| |
| |||
244 | 244 |
| |
245 | 245 |
| |
246 | 246 |
| |
247 |
| - | |
| 247 | + | |
248 | 248 |
| |
249 | 249 |
| |
250 | 250 |
| |
| |||
283 | 283 |
| |
284 | 284 |
| |
285 | 285 |
| |
286 |
| - | |
| 286 | + | |
287 | 287 |
| |
288 | 288 |
| |
289 | 289 |
| |
| |||
305 | 305 |
| |
306 | 306 |
| |
307 | 307 |
| |
308 |
| - | |
| 308 | + | |
309 | 309 |
| |
310 | 310 |
| |
311 | 311 |
| |
| |||
340 | 340 |
| |
341 | 341 |
| |
342 | 342 |
| |
343 |
| - | |
| 343 | + | |
344 | 344 |
| |
345 | 345 |
| |
346 | 346 |
| |
| |||
358 | 358 |
| |
359 | 359 |
| |
360 | 360 |
| |
361 |
| - | |
| 361 | + | |
362 | 362 |
| |
363 | 363 |
| |
364 | 364 |
| |
| |||
387 | 387 |
| |
388 | 388 |
| |
389 | 389 |
| |
390 |
| - | |
| 390 | + | |
391 | 391 |
| |
392 | 392 |
| |
393 | 393 |
| |
| |||
415 | 415 |
| |
416 | 416 |
| |
417 | 417 |
| |
418 |
| - | |
| 418 | + | |
419 | 419 |
| |
420 | 420 |
| |
421 | 421 |
| |
|
Lines changed: 10 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
31 |
| - | |
| 31 | + | |
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
| |||
121 | 121 |
| |
122 | 122 |
| |
123 | 123 |
| |
124 |
| - | |
125 |
| - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
126 | 133 |
| |
127 | 134 |
| |
128 | 135 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
267 | 267 |
| |
268 | 268 |
| |
269 | 269 |
| |
270 |
| - | |
| 270 | + | |
271 | 271 |
| |
272 | 272 |
| |
273 | 273 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
9 |
| - | |
| 9 | + | |
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
15 |
| - | |
16 |
| - | |
| 15 | + | |
| 16 | + | |
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
|
0 commit comments
Comments
(0)