IgniteCache (key, value ) design question

classic Classic list List threaded Threaded
2 messages Options
diopek diopek
Reply | Threaded
Open this post in threaded view

IgniteCache (key, value ) design question

This post has NOT been accepted by the mailing list yet.
I have a DB table with the following fields

ID, FPID1, SAC1, ACCT1, MG1, MS1, attrId,subAttrId,allocPct

there is also unique constraint on these fields


that I believe Ignite will create index for above combination so, either I can define the cache as
IgniteCache(Key(ID), Value(FPID1,SAC1,ACCT1,FRS_BU1,MG1,MS1,attrId,subAttrId,allocPct)>
and run sql like queries;
select * from myIgniteCache where FPID1=? and SAC1=?,ACCT1=?, MG1=?,MS1=?,rsAttrId=?
to get all possible combinations of subAttrId and allocPct for given filter or,
should I define myIgniteCache as;
IgniteCache<KeyObj(FPID1,SAC1,ACCT1,MG1,MS1,rsAttrId), ValueObj<rwaRsSubAttrId,allocPct)>
and do get(keyObj)

which one could perform better?
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view

Re: IgniteCache (key, value ) design question


Key access is always faster than queries, so I would recommend to go with the second option. BTW, you can use fields from key object in queries as well as fields from value object, so your query will work either way.