question

gmldba_107428 avatar image
gmldba_107428 asked Erick Ramirez answered

How can I query tables with set datatypes? (I don't want to use allow filtering option)

I have the following table:

CREATE TABLE servers (
    id uuid,
    hostname text,
    ip inet,
    dc text,
    db text,
    groups set<text>,
    windows boolean,
    PRIMARY KEY ((id, hostname, ip), dc)
) WITH CLUSTERING ORDER BY (dc ASC)

I want to filter on groups. How can I do this? Do I need an Index? I don't want to use allow filtering option. Is there a way I can improve the schema?

schemaqueryingselect
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

@gmldba_107428 you will need to an index on the groups column in order to query it. But be warned that the same caveats apply as other indexes. For more info, see Indexing a collection. Cheers!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.