Hi,

I am using Cassandra Ignite integration. In this integration, one is
able to provide specific "mapping" in persistence xml so a key is e.g.
a primitive and value is POJO.

Now, I was quite surprised (as a lot of other people too as I read
more about this), that it is not possible to do SQL queries on data
which are not in memory / cached as a query is not going down to DB
level when cache is empty - one has to load it all into memory or one
has to know a key so it will be cached (and sql queries can work on
it).

Do not get me wrong but once this is the reality, what is the purpose
of secondary indexes in Cassandra table? For example, I have this
POJO:

@Builder
@Getter
@Setter
@ToString
@EqualsAndHashCode
@AllArgsConstructor
@NoArgsConstructor
public class CustomCounterIgnite implements Serializable {

    @NotNull
    @QuerySqlField(index = true)
    private String username;

    @NotNull
    @QuerySqlField(index = true)
    private Integer counterone;

    @NotNull
    @QuerySqlField(index = true)
    private Integer countertwo;
}

It is said that "in order to do some selects / filtering on fields,
you have to set "index = true" for these fields".

But, given how this SQL mechanism works, once it is in memory, cached,
why there are indexes created in database? What is the purpose if I
can do SQL queries only on data in memory? It does not matter if some
indexes are created in Cassandra or not because it will never go to
database ....

On initialisation, this is the output:

create table if not exists "ignite"."custom_counter"
(
 "username" text,
 "countertwo" int,
 "counterone" int,
 primary key (("username"))
);

Creating indexes for Cassandra table 'ignite.custom_counter'
create index if not exists on "ignite"."custom_counter" ("countertwo");
create index if not exists on "ignite"."custom_counter" ("counterone");
Indexes for Cassandra table 'ignite.custom_counter' were successfully created

Thanks!

Reply via email to