Hi,

you can use "select count(*) from TableName" query. In order to limit
query by particular local node you should set local flag to true and
execute query on this node. In other words you should do something
like this on your node:


IgniteCache cache = ignite.getOrCreateCache(CacheName); // get cache proxy

Query qry = new SqlFieldsQuery("select count(*) from TableName"); //
create query
qry.setLocal(true); // make query local

QueryCursor cursor = cache.query(qry); // exceute query


If table and cache are the same things in your case then you can just
query local cache size without any SQL:

IgniteCache cache = ignite.getOrCreateCache(CacheName); // get cache proxy

int size = cache.localSize(CachePeekMode.ALL);


On Wed, May 17, 2017 at 12:49 PM, blasteralfred <blasteralf...@gmail.com> wrote:
> Hi everyone,
>
> I am learning Ignite, and would like to know if this is possible. Whenever a
> new entry is pushed to cache, I want to confirm it by looking the count,
> just like `numrows` of an sql table. Is this possible? I am trying to build
> a stub, which takes cache name as input and return the number of entries in
> it. Kindly help me if somebody know something regarding this.
>
> Thank you.
>
>
>
> --
> View this message in context: 
> http://apache-ignite-users.70518.x6.nabble.com/How-to-get-number-of-cache-entries-in-a-particular-cache-in-a-single-ignite-instance-tp12966.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to