[Tutor] py-postgressql v1.0.1 question
Luke Paireepinart
rabidpoobear at gmail.com
Sun Sep 12 23:54:37 CEST 2010
>
> Thanks for the tip. I'll do some more research but this sounds promising.
>
> Rance
>
Just be aware that some methods of list building will iterate over the list and evaluate it. So if you only want to retrieve the first 10 results but you do something like
Results = [I.fetch() for I in cursor]
print Results[:10]
You will actually be retrieving all records.
Obviously this is a contrived example and it will be more subtle in practice. Just be cautious that you're not fetching all your data initially and then paging it. You could maybe check your database for the number of results it's returning for each query maybe. I'm not very knowledgeable about database monitoring and optimization but this strikes me as something you could probably do.
More information about the Tutor
mailing list