DEV Community

Discussion on: Optimizing Application Queries With Partition Pruning

Collapse
 
denismagda profile image
Denis Magda

With the index and without table partitioning you scan entire data set - all the pizza orders that are being baked, ordered, delivered, etc. With partitioning you can scan a subset (only delivered pizzas or those that are in progress). You can add an index to partitioned tables as well, thus boosting the search further.

Check the second article for more usage scenarious of the table partitioning:
dev.to/yugabyte/managing-data-plac...

Collapse
 
devworkssimone profile image
DevWorksSimone

I am newbie with database using postgres since a year now, correct ne if I am wrong but does setting and index make me able to avoid full table scan and make the search way more fast (using btree or similar) then without having it ? Not quite following you when you say that I would still run a full table scan using and index. Btw very interesting, going for part 2 ;)

Thread Thread
 
denismagda profile image
Denis Magda

Yeap, you’re right, I confused you. Meant to say that with a single table you index the whole data set and do search with that index.

With table partitioning, you also can define indexes for individual partitions (partitioned tables). Thus, when you run a query two optimizations can kick in - first the partition pruning removes unnecessary partitions/tables and then you do an index search for the remaining partition/table.