|
8 | 8 | * Portions Copyright (c) 1994, Regents of the University of California
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/storage/freespace/freespace.c,v 1.3 2001/07/02 20:50:46 tgl Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/storage/freespace/freespace.c,v 1.4 2001/07/19 21:25:37 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *
|
14 | 14 | * NOTES:
|
@@ -419,9 +419,23 @@ MultiRecordFreeSpace(RelFileNode *rel,
|
419 | 419 | *
|
420 | 420 | * XXX we could probably be smarter about this than doing it
|
421 | 421 | * completely separately for each one. FIXME later.
|
| 422 | + * |
| 423 | + * One thing we can do is short-circuit the process entirely if |
| 424 | + * a page (a) has too little free space to be recorded, and (b) |
| 425 | + * is within the minPage..maxPage range --- then we deleted any |
| 426 | + * old entry above, and we aren't going to make a new one. |
| 427 | + * This is particularly useful since in most cases, all the passed |
| 428 | + * pages will in fact be in the minPage..maxPage range. |
422 | 429 | */
|
423 | 430 | for (i=0;i<nPages;i++)
|
424 |
| -fsm_record_free_space(fsmrel,pages[i],spaceAvail[i]); |
| 431 | +{ |
| 432 | +BlockNumberpage=pages[i]; |
| 433 | +Sizeavail=spaceAvail[i]; |
| 434 | + |
| 435 | +if (avail >=fsmrel->threshold|| |
| 436 | +page<minPage||page>maxPage) |
| 437 | +fsm_record_free_space(fsmrel,page,avail); |
| 438 | +} |
425 | 439 | }
|
426 | 440 | SpinRelease(FreeSpaceLock);
|
427 | 441 | }
|
|