forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitccadf73
committed
Use the buffer cache when initializing an unlogged index.
Some of the ambuildempty functions used smgrwrite() directly, followedby smgrimmedsync(). A few small problems with that:Firstly, one is supposed to use smgrextend() when extending arelation, not smgrwrite(). It doesn't make much difference inproduction builds. smgrextend() updates the relation size cache, soyou miss that, but that's harmless because we never use the cachedrelation size of an init fork. But if you compile withCHECK_WRITE_VS_EXTEND, you get an assertion failure.Secondly, the smgrwrite() calls were performed before WAL-logging, sothe page image written to disk had 0/0 as the LSN, not the LSN of theWAL record. That's also harmless in practice, but seems sloppy.Thirdly, it's better to use the buffer cache, because then you don'tneed to smgrimmedsync() the relation to disk, which adds latency.Bypassing the cache makes sense for bulk operations like indexcreation, but not when you're just initializing an empty index.Creation of unlogged tables is hardly performance bottleneck in anyreal world applications, but nevertheless.Backpatch to v16, but no further. These issues should be harmless inpractice, so better to not rock the boat in older branches.Reviewed-by: Robert HaasDiscussion:https://www.postgresql.org/message-id/6e5bbc08-cdfc-b2b3-9e23-1a914b9850a9@iki.fi1 parentee99330 commitccadf73
File tree
5 files changed
+62
-89
lines changed- contrib/bloom
- src/backend/access
- nbtree
- spgist
5 files changed
+62
-89
lines changedLines changed: 3 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
129 | 129 |
| |
130 | 130 |
| |
131 | 131 |
| |
132 |
| - | |
| 132 | + | |
133 | 133 |
| |
134 | 134 |
| |
135 | 135 |
| |
| |||
163 | 163 |
| |
164 | 164 |
| |
165 | 165 |
| |
166 |
| - | |
167 |
| - | |
168 |
| - | |
169 |
| - | |
170 |
| - | |
171 |
| - | |
172 |
| - | |
173 |
| - | |
174 |
| - | |
175 |
| - | |
176 |
| - | |
177 |
| - | |
178 |
| - | |
179 |
| - | |
180 |
| - | |
181 |
| - | |
182 |
| - | |
183 |
| - | |
184 |
| - | |
185 |
| - | |
186 |
| - | |
187 |
| - | |
188 |
| - | |
189 |
| - | |
190 |
| - | |
| 166 | + | |
| 167 | + | |
191 | 168 |
| |
192 | 169 |
| |
193 | 170 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
177 | 177 |
| |
178 | 178 |
| |
179 | 179 |
| |
180 |
| - | |
| 180 | + | |
181 | 181 |
| |
182 | 182 |
| |
183 | 183 |
| |
|
Lines changed: 5 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
443 | 443 |
| |
444 | 444 |
| |
445 | 445 |
| |
446 |
| - | |
| 446 | + | |
447 | 447 |
| |
448 | 448 |
| |
449 | 449 |
| |
450 | 450 |
| |
451 | 451 |
| |
452 | 452 |
| |
453 | 453 |
| |
454 |
| - | |
| 454 | + | |
| 455 | + | |
455 | 456 |
| |
456 |
| - | |
| 457 | + | |
| 458 | + | |
457 | 459 |
| |
458 | 460 |
| |
459 | 461 |
| |
|
Lines changed: 21 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
151 | 151 |
| |
152 | 152 |
| |
153 | 153 |
| |
| 154 | + | |
154 | 155 |
| |
155 | 156 |
| |
156 |
| - | |
157 |
| - | |
158 |
| - | |
159 |
| - | |
160 | 157 |
| |
161 |
| - | |
162 |
| - | |
163 |
| - | |
164 |
| - | |
165 |
| - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
166 | 164 |
| |
167 |
| - | |
168 |
| - | |
169 |
| - | |
170 |
| - | |
171 |
| - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
172 | 168 |
| |
173 |
| - | |
174 |
| - | |
175 |
| - | |
176 |
| - | |
177 |
| - | |
178 |
| - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
179 | 180 |
| |
180 | 181 |
| |
181 | 182 |
| |
|
Lines changed: 32 additions & 39 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
155 | 155 |
| |
156 | 156 |
| |
157 | 157 |
| |
158 |
| - | |
159 |
| - | |
160 |
| - | |
161 |
| - | |
162 |
| - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
163 | 161 |
| |
164 | 162 |
| |
165 |
| - | |
166 |
| - | |
167 |
| - | |
168 |
| - | |
169 |
| - | |
| 163 | + | |
170 | 164 |
| |
171 |
| - | |
172 |
| - | |
173 |
| - | |
174 |
| - | |
175 |
| - | |
176 |
| - | |
177 |
| - | |
178 |
| - | |
179 |
| - | |
180 |
| - | |
181 |
| - | |
182 |
| - | |
183 |
| - | |
184 |
| - | |
185 |
| - | |
186 |
| - | |
187 |
| - | |
188 |
| - | |
189 |
| - | |
190 |
| - | |
191 |
| - | |
192 |
| - | |
193 |
| - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
194 | 171 |
| |
195 |
| - | |
196 |
| - | |
197 |
| - | |
198 |
| - | |
199 |
| - | |
200 |
| - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
201 | 194 |
| |
202 | 195 |
| |
203 | 196 |
| |
|
0 commit comments
Comments
(0)