You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Mikhail Fokanov <wm...@mail.ru> on 2016/12/27 13:31:41 UTC

Re[2]: Polymorphic SQL queries

Thanks a lot, Sergi. I store the data in the same cache. Could you explain a little more extensively, what should I change in configuration of cache in order to use Binary types of different structure with the same binary type?

About CROSS join: I mean that queries like SELECT * FROM Person, City is cross joins (https://ru.wikipedia.org/wiki/Join_(SQL)#CROSS_JOIN)

--
Best Regards,
Mikhail Fokanov

>Вторник, 27 декабря 2016, 15:13 +03:00 от Sergi Vladykin <se...@gmail.com>:
>
>Hi,
>
>Right now I see only one way to store different value types in the same SQL table: you can use Binary types of different structure with the same binary type and store them in the same cache.
>
>I did not find anything about CROSS joins in our docs, may be you have confused it with cross-cache join? Because we actually do support INNER and OUTER joins. 
>
>Sergi
>
>2016-12-27 14:48 GMT+03:00 Mikhail Fokanov  < wmaster@mail.ru > :
>>Hi,
>>
>>               I use Apache Ignite for high-loaded portal. Performance of SQL queries are ok, but I can't find a way of implementing polymorphic SQL queries. I need to index all sub-classes of the class in SINGLE_TABLE strategy (ex. ImageFile, PdfFile as sub-classes of File), in order to execute queries like (select * from File where createdDate > 0). For such query I can use "union all" and search all sub-classes, but now the amount of sub-classes is 15 and this solution looks bad. Also I need to join User table with File table and I think "union all" will be bad for performance in such case. Am I right? I try to manage Query Entities in CacheConfiguration, but have no success. Can I implement some hack to store entities of all sub-classes in the same table (File) and execute queries on it?
>>               Also I mention that in guide ( http://apacheignite.gridgain.org/docs/sql-queries ) sql joins are always CROSS. Can I use INNER joins and does it improve the performance of query?
>>
>>--
>>Best Regards,
>>Mikhail Fokanov


Re: Re[2]: Polymorphic SQL queries

Posted by Sergi Vladykin <se...@gmail.com>.
You can look at the following example with binary objects and SQL queries:
[1]

Ok, you are more precise :) I treated `SELECT * FROM Person, City` as INNER
join without a predicate, because implementationwise they are the same
thing. If you have indexes on joined fields query will work faster.

Sergi

[1]
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/binary/datagrid/CacheClientBinaryQueryExample.java


2016-12-27 16:31 GMT+03:00 Mikhail Fokanov <wm...@mail.ru>:

> Thanks a lot, Sergi. I store the data in the same cache. Could you explain
> a little more extensively, what should I change in configuration of cache
> in order to use Binary types of different structure with the same binary
> type?
>
> About CROSS join: I mean that queries like SELECT * FROM Person, City is
> cross joins (https://ru.wikipedia.org/wiki/Join_(SQL)#CROSS_JOIN)
>
> --
> Best Regards,
> Mikhail Fokanov
>
> Вторник, 27 декабря 2016, 15:13 +03:00 от Sergi Vladykin <
> sergi.vladykin@gmail.com>:
>
>
> Hi,
>
> Right now I see only one way to store different value types in the same
> SQL table: you can use Binary types of different structure with the same
> binary type and store them in the same cache.
>
> I did not find anything about CROSS joins in our docs, may be you have
> confused it with cross-cache join? Because we actually do support INNER and
> OUTER joins.
>
> Sergi
>
> 2016-12-27 14:48 GMT+03:00 Mikhail Fokanov <wm...@mail.ru>:
>
> Hi,
>
>                I use Apache Ignite for high-loaded portal. Performance of
> SQL queries are ok, but I can't find a way of implementing polymorphic SQL
> queries. I need to index all sub-classes of the class in SINGLE_TABLE
> strategy (ex. ImageFile, PdfFile as sub-classes of File), in order to
> execute queries like (select * from File where createdDate > 0). For such
> query I can use "union all" and search all sub-classes, but now the amount
> of sub-classes is 15 and this solution looks bad. Also I need to join User
> table with File table and I think "union all" will be bad for performance
> in such case. Am I right? I try to manage Query Entities in
> CacheConfiguration, but have no success. Can I implement some hack to store
> entities of all sub-classes in the same table (File) and execute queries on
> it?
>                Also I mention that in guide (http://apacheignite.gridgain.
> org/docs/sql-queries) sql joins are always CROSS. Can I use INNER joins
> and does it improve the performance of query?
>
> --
> Best Regards,
> Mikhail Fokanov
>
>
>
>