r4fek / django-cassandra-engine

Django Cassandra Engine - the Cassandra backend for Django
BSD 2-Clause "Simplified" License
364 stars 85 forks source link

Problem of reading data from large tables #128

Closed Miladkhodabandehloo closed 4 years ago

Miladkhodabandehloo commented 5 years ago

Hi, i have a table that has about 150000 rows. i want to paginate the data in this table like this. all_records = TestModel.objects.all().limit(None) page1 = all_records[0:1000] page2 = all_records[1000:2000]

all the below codes takes equal time to be performed and the time is equal to reading all the records. all_records[0] all_records[0:100] all_records[0:10000] how to prevent this and read just the data that i need. If i do it wrong how can i do it right. thanks in advance.

r4fek commented 4 years ago

As for pagination please check this piece of docs: https://docs.datastax.com/en/developer/python-driver/3.21/query_paging/

(Sorry for such late response! :D)