[Monetdb-developers] BAT sizes

Stefan Manegold Stefan.Manegold at cwi.nl
Fri Oct 5 11:42:40 CEST 2007


Henning,

batsize and batdsksize give you the actual amount of memory allocated by a
BAT which (e.g. due to alignemnent) might be more than the space require to
store all the BUNs that the BAT actually/currently holds:

MonetDB>var b := bat(void,int,1000);
MonetDB>b.info().reverse().like("batBuns").like("size").print();
#---------------------------------#
# h     t                         # name
# str   str                       # type
#---------------------------------#
[ "4000", "batBuns.size"          ]
[ "4000", "batBuns.maxsize"       ]
MonetDB>b.count().print();
[ 0 ]
MonetDB>b.batsize().print();   
[ 8192 ]
MonetDB>b.batdsksize().print();
[ 512 ]
MonetDB>b.append(1).append(2).append(3);
MonetDB>b.info().reverse().like("size").print();
#---------------------------------#
# h     t                         # name
# str   str                       # type
#---------------------------------#
[ "1",    "hvarsized"             ]
[ "0",    "tvarsized"             ]
[ "4000", "batBuns.size"          ]
[ "4000", "batBuns.maxsize"       ]
MonetDB>b.info().reverse().like("batBuns").like("size").print();
#---------------------------------#
# h     t                         # name
# str   str                       # type
#---------------------------------#
[ "4000", "batBuns.size"          ]
[ "4000", "batBuns.maxsize"       ]
MonetDB>b.count().print();
[ 3 ]
MonetDB>b.batsize().print();   
[ 8192 ]
MonetDB>b.batdsksize().print();
[ 1024 ]

Hope this helps you further.

Stefan


On Fri, Oct 05, 2007 at 11:14:31AM +0200, Henning Rode wrote:
> hej monet-people,
> 
> i was a bit puzzled when using the batsize/batdsksize mil-commands on
> our pf/tijah index BATs:
> 
> our pre_size table is also (void|int). however:
> 
> (dbl(batsize("tj_DFLT_FT_INDEX_size1")) /
> count(bat("tj_DFLT_FT_INDEX_size1"))).print();
> [ 5.1875055810700283 ]
> 
> since this seemed a rather strange size for an entry, i also tried:
> 
> (dbl(batdsksize(bat("tj_DFLT_FT_INDEX_size1"))) /
> count(bat("tj_DFLT_FT_INDEX_size1"))).print();
> [ 4.0000030960842796 ]
> 
> which looks much more as i expected. but where does the difference come
> from? even if i copy the bat:
> 
> var t := bat("tj_DFLT_FT_INDEX_size1").copy();
> (dbl(batsize(t)) / count(t)).print();
> [ 5.1875055810700283 ]
> 
> the result remains the same. can anyone explain this? the pre_size BAT
> is usually so large that 25% more space requirement would probably matter.
> 
> best -henning

-- 
| Dr. Stefan Manegold | mailto:Stefan.Manegold at cwi.nl |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |




More information about the developers-list mailing list