Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
antonaks
Creator II
Creator II

Composite key

Dear colleagues.

I want to ask you how best to create a composite key, to save resources.
AutoNumberHash128 () or by connecting strings [fileld_1] & ' ' & [fileld_2]

1 Solution

Accepted Solutions
bohravanraj
Partner - Creator II
Partner - Creator II

AutoNumber is always better because when we create an composite Key as [fileld_1] & ' ' & [fileld_2] , then for each and every unique Key it will assign a memory and pointer an will consider as an String.

and when we use Autonumber it will consider is as number.

And Number consume less space then string.

Regards,

Vanraj Dinesh Bohra

View solution in original post

7 Replies
tresesco
MVP
MVP

Certain better option is: AutoNumberHash128 ()

effinty2112
Master
Master

Hi Anton,

I would go for autonumber e.g.

Autonumber([fileld_1] & '|' & [fileld_2],'AutoID1_2') as AutoID1_2

Using the '|' as a separator is a good practice unless that symbol is used in any of the fields you are making the composite key out of. The parameter 'AutoID1_2' is just to keep separate this autonumber sequence from any others you might be creating in your script

Cheers

Andrew

antonaks
Creator II
Creator II
Author

Thank you.

I have an old application in legacy. And there are lot of this kind keys (&' '&). This Application has three or four hours update time.

I think if I change them, I lower the update time and physical size of application.

tresesco
MVP
MVP

Yes, with other possible improvement areas, if you try autonumbering, you should see an improvement in file size. However, I would also suggest to be careful of other nuisances of the same like 'load order dependency' (if using without hash.. read here: AutoNumber() vs Auto..Hash() )

bohravanraj
Partner - Creator II
Partner - Creator II

AutoNumber is always better because when we create an composite Key as [fileld_1] & ' ' & [fileld_2] , then for each and every unique Key it will assign a memory and pointer an will consider as an String.

and when we use Autonumber it will consider is as number.

And Number consume less space then string.

Regards,

Vanraj Dinesh Bohra

antonaks
Creator II
Creator II
Author

Thank you colleagues.

I realized that the potential for optimization I have with my legacy is great. Starting with the keys and ending with redundant data. I will continue to work.

antonaks
Creator II
Creator II
Author

Thanks for the link. Very interesting.