You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Edward Chen <ja...@gmail.com> on 2020/04/10 18:42:11 UTC
ignite cache as database table
Hello, trying to load 17m record size of data, size is 3.4G. if pojo
class field defined with QuerySqlField annotation, Ignite will use
roughly 9G memory. If we create ignite cache as database table with
QueryEntity / QueryField, it will use total 20G memory.
The difference is the second one will create H2 database table. Then H2
will keep another copy so that it is using double size of memory ?
Another question is, do we have easy way to define cache as a table ?
now we have to use QueryEntity / QueryField , do we have a
@table(name="My_table_name") annotation ?
Thanks. Ed
Re: ignite cache as database table
Posted by akorensh <al...@gmail.com>.
Hi,
Annotations and QueryEntities are just different ways of specifying the
config.
There should be no differences in how that config is being deployed
inside Ignite.
Currently there is no way to set a table name via annotations. It
defaults to the name of the class.
see:
https://www.gridgain.com/docs/latest/developers-guide/SQL/indexes#configuring-indexes-using-annotations
https://www.gridgain.com/docs/latest/developers-guide/SQL/sql-api#querysqlfield-annotation
More info:
Query Entity based config:
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java
annotation based config:
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/sql/SqlQueriesExample.java
If you see a difference in performance between the two configs please send
a reproducer project and I'll take a look.
Thanks, Alex
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: ignite cache as database table
Posted by Evgenii Zhuravlev <e....@gmail.com>.
Hi.
Can you share both xml configuration and class with entities?
>The difference is the second one will create H2 database table. Then H2
will keep another copy so that it is using double size of memory ?
No, h2 doesn't store a copy of data. Moreover, annotations are used to
prepare QueryEntity configuration, so, it shouldn't have different size.
Have you tried all 3 approaches on a new cluster?
>Another question is, do we have easy way to define cache as a table ?
now we have to use QueryEntity / QueryField , do we have a
@table(name="My_table_name") annotation ?
There is no such annotation. There are 2 ways to configure the table name -
using QueryEntities and by creating table using ddl: "CREATE TABLE ..."
Evgenii
пт, 10 апр. 2020 г. в 11:42, Edward Chen <ja...@gmail.com>:
> Hello, trying to load 17m record size of data, size is 3.4G. if pojo
> class field defined with QuerySqlField annotation, Ignite will use
> roughly 9G memory. If we create ignite cache as database table with
> QueryEntity / QueryField, it will use total 20G memory.
>
> The difference is the second one will create H2 database table. Then H2
> will keep another copy so that it is using double size of memory ?
>
> Another question is, do we have easy way to define cache as a table ?
> now we have to use QueryEntity / QueryField , do we have a
> @table(name="My_table_name") annotation ?
>
> Thanks. Ed
>
>
>
>
>