2

Is there a way to limit results of CohQL query?

My Coherence cache contains million records and it would be very useful to just limit the number of records if I just want to see how a specific entry looks like. for e.g. something like

select top 10 key() from cache

I don't find any such option in CohQL docs.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Rohit
  • 848
  • 3
  • 15
  • 31

2 Answers2

0

ok, so its quite simple... do select top 10 * from <cache-name>

Rohit
  • 848
  • 3
  • 15
  • 31
0

As mentioned in the comments, this is not possible using CohQL but this can be achieved using LimitFilter in Java. Based on your question, you are expecting top results without specifying any order.

Here is an example on how to use LimitFilter from documentation with order by Age desc. If you want your results in random order, you will have to implement the EntryFilter interface to return random entry and use it instead of GreaterEqualsFilter in the example.

Community
  • 1
  • 1
vk239
  • 1,014
  • 1
  • 12
  • 30