Re: Passing dbConnection vs passing cursor

Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization initd.org
Message-ID <[email protected]>
Il giorno dom, 18/05/2008 alle 15.30 +0200, Deon Bredenhann ha scritto:
> In Listing1 vs Listing2. What is the preferred method for send a task to
> a module for the db. Is there a lot of processing overhead in creating a
> cursor for every module call? Is there any problems in reusing the same
> cursor over and over again? How about memory usage between the two?

I better like the first method. Cursors are light weight and there
should be no problems using a lot of them. Just note that a cursor keeps
a reference to the last SELECTed data and that space won't be claimed
back until the GC destroys the cursor.

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
DISCLAIMER. If I receive a message from you, you are agreeing that:
 1. I am by definition, "the intended recipient".
 2. All information in the email is mine to do with as I see fit and
 make such financial profit, political mileage, or good joke as it lends
 itself to. In particular, I may quote it on USENET or the WWW.
 3. I may take the contents as representing the views of your company.
 4. This overrides any disclaimer or statement of confidentiality that
 may be included on your message.

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBIMECWvcCgrgZGjesRAlQyAJ4oe1mjihdWGYQ+9DXWF/c0I6IQAwCeJPHn
bogmAEaB/SePrAZnSslPqBQ=
=NojD
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.