Good point, Valentin! I will add that if you don’t have an affinity key,
but simply know which node owns the data, you can also simply create a
cluster group for that node and send a computation to it which will run the
local query.

On Mon, Jan 25, 2016 at 1:23 PM, vkulichenko <[email protected]>
wrote:

> Hi Andrey,
>
> In case you know that all required data is stored on a single node, you can
> send a closure to that node that will execute a local query:
>
> // Execute a callable on a node where myAffinityKey is mapped.
> ignite.compute().affinityCall("my-cache", myAffinityKey, new
> IgniteCallable<List&lt;List&lt;?>>>() {
>     @Override public List<List&lt;?>> call() throws Exception {
>         IgniteCache cache = Ignition.ignite().cache("my-cache");
>
>         // Note the setLocal(true) flag.
>         return cache.query(new SqlFieldsQuery("select * from
> ...").setLocal(true)).getAll();
>     }
> });
>
> Will this work for you?
>
> -Val
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Sql-query-performance-with-partitioned-caches-tp2700p2708.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Reply via email to