Best way to find MAX value of field in Near cache

classic Classic list List threaded Threaded
4 messages Options
njcstreet njcstreet
Reply | Threaded
Open this post in threaded view
|

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/
stephendarlington stephendarlington
Reply | Threaded
Open this post in threaded view
|

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

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 <[hidden email]> 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/


njcstreet njcstreet
Reply | Threaded
Open this post in threaded view
|

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

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/
stephendarlington stephendarlington
Reply | Threaded
Open this post in threaded view
|

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

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 <[hidden email]> 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/