Hi...

We do the same (even if a lot of people will say it's bad and that you
shouldn't...) with a "allow filtering" BUT ALWAYS  WITHIN A PARTITION AND
WITH A LIMIT CLAUSE TO AVOID A FULL PARTITION SCAN.
.
So you need to know the organisation_id and the product_type...
and paginate your result with "product_name > XXXXX" LIMIT 20" where XXXXX
is the last product_name returned on the previous page (LIMIT is applied
after the WHERE clause and defined the number of rows returned and not the
number of rows scanned)..

This works fine within a partition but if you don't have (organisation_id,
product_type), don't do it and have a look on secondary index.

Le lun. 3 oct. 2022 à 18:26, Karthik K <mailidofkarthike...@gmail.com> a
écrit :

> We have a table designed to retrieve products by name in ascending order.
> OrganisationID and ProductType will be the compound partition key, whereas
> the ProductName will be the clustering key. So, the primary key structure
> is ((organisation_id, product_type), product_name) with clustering order
> by(product_name asc). All have text as a datatype.
>
> We have 20-30 other attributes relevant to the product stored in other
> different columns. Out of which some 5 attributes are significant. For
> instance, those attributes can be description, colour, city, size and
> date_of_manufacturing. All the above attributes are of text datatype except
> for date_of_manufacturing which is a timestamp.
>
> Let's say a user wants to filter this product based on all these 5
> attributes. Can this be done using cassandra? Though we know that this can
> be achieved using elastic search on top of cassandra, our constraint is to
> use cassandra alone and achieve this. Storing data across many tables is
> allowed.
>
> Note:At any instant, only 20 products can be listed in the page, which
> means after applying all filters, we must display only 20 products.
>

Reply via email to