home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre3.z / postgre3 / src / lib / H / access / hrnd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  2.5 KB  |  120 lines

  1. /*
  2.  * hrnd.h --
  3.  *    POSTGRES heap access method randomization definitions.
  4.  *
  5.  * Note:
  6.  *    XXX This file should be moved to heap/.
  7.  *
  8.  * Identification:
  9.  *    $Header: /private/postgres/src/lib/H/access/RCS/hrnd.h,v 1.6 1990/08/17 08:50:47 cimarron Exp $
  10.  */
  11.  
  12. #ifndef    HRndIncluded    /* Include this file only once */
  13. #define HRndIncluded    1
  14.  
  15. #include "tmp/postgres.h"
  16.  
  17. #include "storage/block.h"
  18. #include "utils/rel.h"
  19.  
  20. typedef BlockNumber    *BlockIndexList;
  21.  
  22. /* XXX The following values are *not* tuned in any way */
  23.  
  24. #define MaxLengthOfBlockIndexList    3
  25.  
  26. #define FillLimitBase        16
  27. #define OneBlockFillLimit    (FillLimitBase * 3/8)
  28. #define TwoBlockFillLimit    (FillLimitBase * 1/4)
  29. #define ThreeBlockFillLimit    (FillLimitBase * 3/16)
  30. #define ManyBlockFillLimit    (FillLimitBase * 1/8)
  31. #define ClusteredBlockFillLimit    (FillLimitBase * 1/16)
  32.  
  33. #define ClusteredNumberOfFailures    (1 + MaxLengthOfBlockIndexList)
  34.  
  35. #define FillLimitAdjustment(failures)\
  36.     ((failures >= MaxLengthOfBlockIndexList) ? 0 :\
  37.         (FillLimitBase * (MaxLengthOfBlockIndexList - failures - 1)/16))
  38. /*
  39.  * InitRandom --
  40.  *    Initializes randomization support.
  41.  */
  42. extern
  43. void
  44. InitRandom ARGS((
  45.     void
  46. ));
  47.  
  48. /*
  49.  * getclusteredappend --
  50.  *    Returns block index to use for clustering.
  51.  *
  52.  * Note:
  53.  *    This is a hack utill clustering is supported correctly.
  54.  */
  55. extern
  56. BlockNumber
  57. getclusteredappend ARGS((
  58.     void
  59. ));
  60.  
  61. /*
  62.  * setclusterblockindex --
  63.  *    Causes append clustering on indicated block if enabled.
  64.  *
  65.  * Note:
  66.  *    This is a hack utill clustering is supported correctly.
  67.  */
  68. extern
  69. void
  70. setclusterblockindex ARGS((
  71.     BlockNumber    blockIndex
  72. ));
  73.  
  74. /*
  75.  * setclusterblockindex --
  76.  *    Causes append clustering on indicated block if enabled.
  77.  *
  78.  * Note:
  79.  *    This is a hack utill clustering is supported correctly.
  80.  */
  81. extern
  82. void
  83. setclusterblockindex ARGS((
  84.     BlockNumber    blockIndex
  85. ));
  86.  
  87. /*
  88.  * RelationContainsUsableBlock --
  89.  *    True iff free space in a block of relation is sufficient to hold tuple.
  90.  *
  91.  * Note:
  92.  *    Assumes relation is valid and is not physically empty.
  93.  *    Assumes block index is in valid range.
  94.  *    Assumes tuple size is valid.
  95.  */
  96. extern
  97. bool
  98. RelationContainsUsableBlock ARGS((
  99.     Relation    relation,
  100.     BlockNumber    blockIndex,
  101.     Size        size,
  102.     Index        numberOfFailures
  103. ));
  104.  
  105. /*
  106.  * RelationGetRandomBlockIndexList --
  107.  *    Returns pointer to a static array of randomly generated block indexes.
  108.  *
  109.  * Note:
  110.  *    Assumes relation is valid.
  111.  */
  112. extern
  113. BlockIndexList
  114. RelationGetRandomBlockIndexList ARGS((
  115.     Relation    relation,
  116.     ObjectId    id
  117. ));
  118.  
  119. #endif    /* !defined(HRndIncluded) */
  120.