ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Berry <chriswbe...@gmail.com>
Subject Questions about "ignite-indexing"
Date Fri, 18 Aug 2017 17:13:55 GMT

I have a few questions about efficiency and the “ignite-indexing” module…
(Sorry, I asked this inside another thread, but wanted to surface it as
first-class questions)

I have the following code. Which is clearly inefficient.

    public Set<TKey> getCacheKeys() { 
        String tableName = valueClass.getSimpleName(); 
        SqlFieldsQuery qry = new SqlFieldsQuery("select _key from " +
        Collection<List&lt;?>> res =

        Set<TKey> keys = new HashSet<>(); 
        for(List<?> row : res) { 
        return keys; 

Using a SqlFieldsQuery. 

And I use it like this: 

    public List<Foo> findMatches(SearchTerms searchTerms) { 
        Map<String, Foot> map = cache.getAll(cache.getCacheKeys()); 
        return matchingStrategy.match(map, searchTerms); 

I wanted to get something working – which it is.
But it is clearly inefficient (get all the Keys, to get all the Entries, to
create a local Map)
And my perf-tests validate that this is not the best way to accomplish this.
(Even though this is a relatively small cache) 

So. I have a few questions. 

1) I have only one REPLICATED cache – out of many caches -- that I need to
do a Query against. 
The rest are all used as simple KV stores. 

Have I introduced an inefficiency by introducing the ignite-indexing
Is there a way to use it ONLY for 1 cache?? 

Or is indexing always present, and I have just now become aware of it?? 
(This seems unlikely since the H2 DB issue I encountered when I introduced
“ignite-indexing” should have bitten me sooner??) But, of course, some form
of index must be there to allow the K/V lookup...

2) Would it be more efficient to use a ScanQuery above?? 
Or is the SqlFieldsQuery roughly equivalent?? 

NOTE: I assume to do this whole thing more efficiently I would
use a ScanQuery with a Filter?? 
Which would eliminate the need for the interim copies. 
Is that correct??

3) I am using:  igniteConfig.setMarshaller(new BinaryMarshaller())  --
paired with:  cache.withKeepBinary() 
Do I need to do anything special in this case?? 
Presently it seems not?? 

NOTE:  I am using only this: igniteCacheConfig.setIndexedTypes(keyClass,
And it all is working as expected. 
Still. If I used IgniteBiPredictae would it be more efficient?? 

-- Chris  

View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Questions-about-ignite-indexing-tp16292.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

View raw message