home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / database / informix / 2806 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  4.3 KB

  1. Path: sparky!uunet!gatech!darwin.sura.net!spool.mu.edu!olivea!gossip.pyramid.com!pyramid!infmx!davek
  2. From: davek@informix.com (David Kosenko)
  3. Newsgroups: comp.databases.informix
  4. Subject: Re: Calculating Extents
  5. Message-ID: <1992Dec23.170729.20715@informix.com>
  6. Date: 23 Dec 92 17:07:29 GMT
  7. References: <1h7gs3INNef3@emory.mathcs.emory.edu>
  8. Sender: news@informix.com (Usenet News)
  9. Organization: Informix Software, Inc.
  10. Lines: 72
  11.  
  12. Naomi Walker writes:
  13. >
  14. >Can someone please tell me a reliable way to calculate extents
  15. >on tables with TEXT BLOBS?  I've tried using the formula in the
  16. >book, but that doesnt work well.  In our case, this BLOB is in 
  17. >the tblspace, not in a blobspace.  Does it make a difference?
  18.  
  19. Absolutely!  If your blobs are in a blobspace, then you only need add
  20. 56 bytes (the size of the struct stored in the table to locate the blob)
  21. for each blob column to your rowsize, and calculate the extent size as
  22. for a "regular" row.  When you use tblspace blobs, the space required for
  23. the blob storage must be included in the extent sizing.  I'll outline some
  24. details on this further on.
  25.  
  26. >Should I just use the average size of our BLOBS (2k) for the row length?  
  27.  
  28. No, but an average size will be used in the calculation.
  29.  
  30. >How do you calculate extents on varchars?  
  31.  
  32. There are a few options here.  You are just adding the "size" of the column to
  33. those of the rest of the columns to come up with a rowsize, but the question is
  34. what "size" to use for a varchar.  You can use the max possible size the
  35. varchar column you've defined could be (my preference); you could use the
  36. average estimated size (ok if you have a good idea of the data going in); you
  37. could use the min reserved size (if you use a min length for the definition).
  38. Pick one, and use it to calculate the rowsize.  The rest of the calculation
  39. is the same as in the book.
  40.  
  41. >Does the extent formula hold true if the table has no indicies?
  42.  
  43. Yes, you just have a 0 size value for your index calculation, i.e. you only
  44. need size the data component.  There is no additional overhead for indexing
  45. on a table with no indexes.
  46.  
  47.  
  48. ok, now for adding tblspace blobs (TBs from here on) into the extent 
  49. calculation.  First, understand that, while TBs are stored in the extents
  50. with the rest of the data, they are kept on their own pages.  So calculate
  51. the pages needed for data (still using 56 bytes for each blob column when
  52. calculating the row size), and the pages needed for the indexes.  Then
  53. calculate your "blob paging"; this is the number of blob "items" that will
  54. fit in a tblspace blob page (which is your pagesize).  Recall that there
  55. is 24 bytes of overhead in each page, so for a 2K page size, the useable
  56. space will be 2020 bytes.  If you have very small blobs, many "items" will
  57. fit onto a page.  If they are larger than a page, several pages will be
  58. needed to hold the blob data.  One page will be filled, and the other will
  59. use as much space as necessary for the remainder.  Note that these "blob
  60. remainder pages" can hold remainders from several blobs.  Also note that
  61. each blob "item piece" will require an 8 byte slot table entry on the page
  62. in which it is stored, and each "non terminating" piece will require a 4
  63. byte forwarding pointer (to the "next piece").  So, to use your 2K blobs as 
  64. an example, we can calculate:
  65.  
  66.     Since 2048 is greater that the page capacity, we'll need 1.x pages
  67. to store each blob.  If we have 2020 bytes available on a page, and
  68. 8 + 4 bytes overhead is needed for each piece of blob data stored on the page,
  69. we know that 2008 bytes of a blob will fit on a page, leaving a 40 byte
  70. remainder piece to go onto another page. Each remainder will have 8 bytes of
  71. overhead (no forwarding pointer is necessary since it is a terminating piece),
  72. so each remainder will use up 48 bytes on that remainder page.  With 2020
  73. bytes available on a remainder page, we can get 42 remainder pieces onto
  74. that blob remainder page.  So, to make the math easier, we would need 43
  75. pages to store 42 2K blobs.  This is in addition to the number of pages
  76. needed to store data and index stuff.
  77.  
  78. Dave
  79. -- 
  80. Disclaimer: These opinions are not those of Informix Software, Inc.
  81. **************************************************************************
  82. "I look back with some satisfaction on what an idiot I was when I was 25,
  83.  but when I do that, I'm assuming I'm no longer an idiot." - Andy Rooney
  84.