Re: Help calculating extents from esql-c
Posted in 1995
Randy, I promise, tbcheck/oncheck is going to be the easiest way for you to go. The formula you have is just too simplistic. For example, let's look at data pages. Each data page is probably 2K on your system. For data pages though, there is a 28 byte overhead. Each row will also have a 4 byte overhead. So, the calulation would be something like: # of pages = ((2048 - 28) / (4 + row size)) * number of rows. And that's the easy one. Indexes are much harder! You start by calulating the "row length" for your index. It's something like 4 bytes for the rowid plus the length of your indexed columns. Then, you figure out how many of those will fit onto a page. Then you take a guess at how many pages your index will take. Don't forget the btree overhead! Don't forget about your fill factors. Of course, Informix is sometimes able to compress the index if you have duplicate rows. Etc... It's a real pain! Plus, you still have to worry about partition pages, bit maps, and so on. Luckily, though, you're using "C". What you can do instead is execute a tbcheck command like: #define cmd "tbcheck -pt dbname:tbname|grep 'pages used'|cut -f4 > myfile" system(cmd); You can then read in the file and get the number of pages you're looking for. Keep in mind that this is all untested! I'm just rattling off the top of my head. --Craig (craig@chemistry.utah.edu) > > i don't think I am going to be able to use the index cluster method. I > don't have enough > dbspace. > > My application is a table modification program. I have a bunch (65) > databases that > have the exact databases (Data Replication sites). When I mod a table I > have to > unload mod delete the table , create the new modified table and reload > the data. > > Anyways (I am sorry to be so long winded), when I create the table i want > to create it > with the correct extents. > > This is the formula I was given. > > extent_size = (page_size + index_size) * row_cnt / system_page_size > > is this correct? When I calculate this way it doesn't come out the same > as the > shell script. >