# How to find all of the database's partitions efficiently, full table scan

**URL:** <https://forum.scylladb.com/t/how-to-find-all-of-the-databases-partitions-efficiently-full-table-scan/2834>\
**Category:** ScyllaDB\
**Tags:** data-model, performance, cql\
**Created:** [September 1, 2024, 5:34am UTC](https://forum.scylladb.com/t/how-to-find-all-of-the-databases-partitions-efficiently-full-table-scan/2834 "2024-09-01T05:34:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/guy/32/9_2.png) [@Guy](https://forum.scylladb.com/u/Guy)\
**Post date:** [September 1, 2024, 5:34am UTC](https://forum.scylladb.com/t/how-to-find-all-of-the-databases-partitions-efficiently-full-table-scan/2834/1 "2024-09-01T05:34:36Z")

</div>

> [@](#):
>
> [**Originally from the User Slack**](https://scylladb-users.slack.com/)
> 
> ![Dylan_Piette](https://us1.discourse-cdn.com/flex016/uploads/scylladb/original/1X/a8cf80ed511950142e15ca1004fbc85b85814271.png) **@Dylan\_Piette:** Hello to the scylladb team, I’m currently facing the issue of needing to know all the current partitions in the db in a performant way  
> Is there any recommandations on how to do it ? I need to know the values of the pk, not just the count or something like that  
> [https://github.com/scylladb/scylladb/issues/2066](https://github.com/scylladb/scylladb/issues/2066)
> 
> > GitHub: Really slow select distinct · Issue #2066 · scylladb/scylladb
> 
> ![Felipe_Cardeneti_Mendes](https://us1.discourse-cdn.com/flex016/uploads/scylladb/original/1X/233a9d524fbc97e39f08633c16b3dd2575d1d1f4.jpeg) **@Felipe\_Cardeneti\_Mendes:** [https://www.scylladb.com/2017/03/28/parallel-efficient-full-table-scan-scylla/](https://www.scylladb.com/2017/03/28/parallel-efficient-full-table-scan-scylla/) there’s some boilerplate Go code in the relevant github repo, it originally just counts IIRC - but should be straightforward to iterate and save values.
> 
> ![Sven](https://us1.discourse-cdn.com/flex016/uploads/scylladb/original/2X/c/c6d734a754ef247591c89cd8852d54acb7e0805c.png) **@Sven:** @Dylan\_Piette For years we have just used `SELECT DISTINCT our_partition_key_column_name FROM our_table_name` and it has worked without problems. However, note that we do not have a big database. In our case, the result set to this query within any keyspace contains at most 100000 partition key values, which in our case are `UUID`s.
> 
> ![Piette_Dylan](https://us1.discourse-cdn.com/flex016/uploads/scylladb/original/1X/13ede6998e34da7c0e8b811b97524a16b9336e2e.png) **@Piette\_Dylan:** Well in our use case we have millions of partitions and the data is volatile, a partition can be gone in a few seconds (we deleted all the rows for that partition)  
> So we need a fast way to get the most accurate representation of what is actually inside the table  
> The solution @Felipe\_Cardeneti\_Mendes linked is a great one right now, after adapting the code I’m now able to query all the partitions 6x faster which is already great !  
> But I can’t help wishing for a near instant way to get this data haha
