How can I reduce the number of queries to my PostgreSQL database?

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Tue Apr 11 03:12:54 EDT 2006


In article <1144489087.794505.277930 at v46g2000cwv.googlegroups.com>,
 "SR" <shay at shay-riggs.fsnet.co.uk> wrote:

>The script works fine, if a little slow. I think that's because if I
>have 50 books in my database, my script performs 51 database queries (1
>for all book names; then 1 for each book)

If your database is that small, why bother with sophisticated 
relational-database queries at all? Why not just load everything into 
memory, and use sets and dicts and things to put it all together?

This is feasible for databases with up to thousands or even tens of 
thousands of records in them, on today's machines.



More information about the Python-list mailing list