Does anyone know some documents regarding how to make good global structure that helps overall database performance?
Currently I am building a database and have a couple questions.
1. If I have a global with a lot of nodes in the global tree, how much additional storage space will be used if the global has a long name? For example ^ABC vs ^ABCDEFGHIJK?
2. If a subscript has a lot of sub nodes in it, how much additional space is used if the subscript is like "abc", vs "abcdefghijklmn"? I know M stores number just as string, different from C, does it have storage advantage using number 123 as subscript vs using "abc" as subscript.
Thanks in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Your questions are very closely related to your previous thread(s) where we discussed some aspects of database tuning too.
You should also read GT.M administration documentation, especially chapter about GT.M Database Structure (GDS). This chapter is exactly about what you're asking!
Note that the best way how to find out answers for your questions is to analyze/tune your Global Directory settings, especially block/key/record sizes. Of course, underlying filesystem may be your point of interest too :-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In Intersystem Cache, there is %GSIZE to check the global size saved on hard drive. Any similar function from GT.M? I could not find it from the Utility Routines in GT.M Manual.
Also is there a way go get milisecond from GT.M. Not to be absolute value, relative value will be fine. Thanks,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Q: If I have a global with a lot of nodes in the global tree, how much additional storage space will be used if the global has a long name? For example ^ABC vs ^ABCDEFGHIJK?
A: The first node in each database block will store the complete global variable name; owing to key compression, other nodes will not store the name. So, the additional space is 8 bytes per data or index block.
Q: If a subscript has a lot of sub nodes in it, how much additional space is used if the subscript is like "abc", vs "abcdefghijklmn"? I know M stores number just as string, different from C, does it have storage advantage using number 123 as subscript vs using "abc" as subscript.
A: First, GT.M does not store numbers as strings. In the database, numbers are stored as numbers using a packed decimal format that lends itself to key compression.
Q: In Intersystem Cache, there is %GSIZE to check the global size saved on hard drive. Any similar function from GT.M? I could not find it from the Utility Routines in GT.M Manual.
A: The output of mupip integ -full -fast will give you that information.
Q: Also is there a way go get milisecond from GT.M. Not to be absolute value, relative value will be fine.
A: You can call out to the system function gettimeofday() to get that information. A forthcoming GT.M plugin will provide a $$zhorolog^%POSIX extrinsic special variable that will give you time with microsecond resolution in $horolog format. (It just calls out to gettimeofday() just as you can already.)
Regards
- Bhaskar
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does anyone know some documents regarding how to make good global structure that helps overall database performance?
Currently I am building a database and have a couple questions.
1. If I have a global with a lot of nodes in the global tree, how much additional storage space will be used if the global has a long name? For example ^ABC vs ^ABCDEFGHIJK?
2. If a subscript has a lot of sub nodes in it, how much additional space is used if the subscript is like "abc", vs "abcdefghijklmn"? I know M stores number just as string, different from C, does it have storage advantage using number 123 as subscript vs using "abc" as subscript.
Thanks in advance
Your questions are very closely related to your previous thread(s) where we discussed some aspects of database tuning too.
You should also read GT.M administration documentation, especially chapter about GT.M Database Structure (GDS). This chapter is exactly about what you're asking!
Note that the best way how to find out answers for your questions is to analyze/tune your Global Directory settings, especially block/key/record sizes. Of course, underlying filesystem may be your point of interest too :-)
Thanks a lot.
Two more question
In Intersystem Cache, there is %GSIZE to check the global size saved on hard drive. Any similar function from GT.M? I could not find it from the Utility Routines in GT.M Manual.
Also is there a way go get milisecond from GT.M. Not to be absolute value, relative value will be fine. Thanks,
Q: If I have a global with a lot of nodes in the global tree, how much additional storage space will be used if the global has a long name? For example ^ABC vs ^ABCDEFGHIJK?
A: The first node in each database block will store the complete global variable name; owing to key compression, other nodes will not store the name. So, the additional space is 8 bytes per data or index block.
Q: If a subscript has a lot of sub nodes in it, how much additional space is used if the subscript is like "abc", vs "abcdefghijklmn"? I know M stores number just as string, different from C, does it have storage advantage using number 123 as subscript vs using "abc" as subscript.
A: First, GT.M does not store numbers as strings. In the database, numbers are stored as numbers using a packed decimal format that lends itself to key compression.
Q: In Intersystem Cache, there is %GSIZE to check the global size saved on hard drive. Any similar function from GT.M? I could not find it from the Utility Routines in GT.M Manual.
A: The output of mupip integ -full -fast will give you that information.
Q: Also is there a way go get milisecond from GT.M. Not to be absolute value, relative value will be fine.
A: You can call out to the system function gettimeofday() to get that information. A forthcoming GT.M plugin will provide a $$zhorolog^%POSIX extrinsic special variable that will give you time with microsecond resolution in $horolog format. (It just calls out to gettimeofday() just as you can already.)
Regards
- Bhaskar
Thanks a lot.