You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by njcstreet <nj...@gmail.com> on 2020/09/29 08:16:10 UTC

Best way to find MAX value of field in Near cache

Hi,

I have a replicated cache that is fronted by a near cache in my client (data
loader) application. In this cache I have an integer field which is used as
a lookup key into the cache. I am using IgniteAtomicSequence to generate
this lookup key (since I believe there is no such thing as an auto increment
identity column). But when my loader starts, I need to be able to determine
the MAX lookup key to put this as the initial value for the sequence.

What is the best way to lookup the MAX value of a field that is fronted by a
near cache, since i can’t seem to use SQL against a near cache?

Thanks.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Best way to find MAX value of field in Near cache

Posted by Stephen Darlington <st...@gridgain.com>.
What it means is that the near cache isn’t used when you execute the SQL query. A subtle but important difference! 

> On 29 Sep 2020, at 15:15, njcstreet <nj...@gmail.com> wrote:
> 
> Hi,
> 
> Sorry yes you are right - it does seem to work. I had seen the post below:
> 
> http://apache-ignite-users.70518.x6.nabble.com/How-sql-works-for-near-cache-td30518.html
> 
> Where the answer says “ SQL doesn't work with near caches at all” but I
> guess this is wrong.
> 
> Thanks!
> 
> 
> 
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/



Re: Best way to find MAX value of field in Near cache

Posted by njcstreet <nj...@gmail.com>.
Hi,

Sorry yes you are right - it does seem to work. I had seen the post below:

http://apache-ignite-users.70518.x6.nabble.com/How-sql-works-for-near-cache-td30518.html

Where the answer says “ SQL doesn't work with near caches at all” but I
guess this is wrong.

Thanks!



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Best way to find MAX value of field in Near cache

Posted by Stephen Darlington <st...@gridgain.com>.
How are you creating your cache? You can absolutely use SQL with a cache that has a near cache.

> On 29 Sep 2020, at 09:16, njcstreet <nj...@gmail.com> wrote:
> 
> Hi,
> 
> I have a replicated cache that is fronted by a near cache in my client (data
> loader) application. In this cache I have an integer field which is used as
> a lookup key into the cache. I am using IgniteAtomicSequence to generate
> this lookup key (since I believe there is no such thing as an auto increment
> identity column). But when my loader starts, I need to be able to determine
> the MAX lookup key to put this as the initial value for the sequence.
> 
> What is the best way to lookup the MAX value of a field that is fronted by a
> near cache, since i can’t seem to use SQL against a near cache?
> 
> Thanks.
> 
> 
> 
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/