Best way to check for filtered strings in Kassandra? by user aggregate?

I have a Cassandra table,

CREATE TABLE read_locks (
    parent_path text,
    filename text,
    instance text,
    PRIMARY KEY ((parent_path, filename), instance)
);

Logically, I want to check for any locks in the file with the following expression:

select count(*)>0 as result from read_locks where parent_path='...' and filename='...';

Of course, I have at least 2 implementations.

select count(*) as result from read_locks where parent_path='...' and filename='...';

and then use another code, such as C ++, to check the value of the result.

or

select * from read_locks where parent_path='...' and filename='...';

and then use another code, such as C ++, to check the bool value of the following statement:

cass_iterator_next(rows)

I'm not sure which is better.

And I think there is a user aggregate function for this, but I could not understand.

Share your comments.

Thanks in advance

0
source share
1 answer

, - , , , , :

SELECT * FROM read_locks WHERE parent_path='...' and filename='...' LIMIT 1;

, , , , .

0

Source: https://habr.com/ru/post/1621637/


All Articles