I have following type of data into my database and want to store into Gemfire.
+------------------------------+--------------------------------+----------------------------------------+----------------------------------+----------------------------------+------------------------------------+-----------------------------------+------------------------------+------------------------+----------------------------+-------------------------------------+--+
| A | B | C | D | E | F | G | H | I | J | date |
+------------------------------+--------------------------------+----------------------------------------+----------------------------------+----------------------------------+------------------------------------+-----------------------------------+------------------------------+------------------------+----------------------------+-------------------------------------+--+
| VK | XXXXXXXXXXXXXXXX | YYY | VBGFD | 9 | 193.83 | 9 | T | | False | 2017-08-25 |
| VK | XXXXXXXXXXXXXXXX | YYY | VBGFD | 25.22 | 193.83 | 9 | T | | False | 2017-08-25 |
| VK | XXXXXXXXXXXXXXXX | YYY | VBGFD | 9 | 112.23 | 9 | T | | False | 2017-08-25 |
| VK | XXXXXXXXXXXXXXXX | YYY | VBGFD | NULL | 89.98 | NULL | T | | False | 2017-08-25 |
+------------------------------+--------------------------------+----------------------------------------+----------------------------------+----------------------------------+------------------------------------+-----------------------------------+------------------------------+------------------------+----------------------------+-------------------------------------+--+
4 rows selected (2.248 seconds)
1) You can see data is duplicate and any one column with different values would be consider as unique row.
2) I cannot use any column as Gemfire key as will override values (since data is duplicate )
I have following two possible solutions:
Approach 1
I can use composite key (pojo) as gemfire key but issue is that i need to use same pojo as key and value (as per data )
package data;
Class KEY{
private String A;
private String B ;
private String C ;
private String D ;
private String E ;
private String F;
private String G ;
private String H ;
private String I ;
private String J ;
private String date ;
}
package data
Class Value{
private String A;
private String B ;
private String C ;
private String D ;
private String E ;
private String F;
private String G ;
private String H ;
private String I ;
private String J ;
private String date ;
}
put --key=(KEY) --value=(Value) --region=/region1 --key-class=data.KEY --value-class=data.Value
Issue with this approach is that , it will double my data size in region and my loader start throwing out of memory error.
Approach 2
Create auto increment id into database and use this id as key but then i need to create index ,increment id would not be part of my sql.
My Query
query --query='select a,b,c,d,e,f,g,h,i,j,date from / myRegion where a=VK and b=XXXXXXXXXXXXXXXX and c=YYY and F=193.83'
I am wonder if anyone come across same scenario ?
Update : I have decided to use auto increment id (Long) as key and pojo as value. Planing to create Range index on column.