Hi, You can't. The way that you are working - it would always go back to the database - because you are using the filter methods.
You would need to create a list from the items, then do the comparison in python - which probably will be slower (but not necessarily). Regards, Andréas Den ons 13 mars 2019 kl 12:44 skrev Vaibhav Mishra <mevaib...@gmail.com>: > Hi All, > > I have a table of over 100,000 rows which I need to compare with another > list to find if the entry matching a rows is in there or not > > The following does not work > > getdata = data.objects.all() > > > mydata= getdata.filter(mycriteria) > > > > > Process information and comparision from 'mydata' > > > > .The code .should fetch all data and should no longer go to Database. , > but it still seem to hit database > . > Whenever I am running code, I see that for each comparision , the Code is > Hitting the database resulting in over thousands of queries and lot of > delay in finishing Processing data. > > How can I force All Data to be stored in RAM so that its no longer needed > to access database. ? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/a120e643-936e-4f6a-9662-7811808fa8cf%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/a120e643-936e-4f6a-9662-7811808fa8cf%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK4qSCevkAVGFf%3DMrS8VVsv2BgPuDkRUqW_tSFwk1dfrzb7pvg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.