Performance Problems when selecting HUGE amounts of data from MySQL dbs
Gabriel Ambuehl
gabriel_ambuehl at buz.ch
Wed Jan 9 10:53:28 EST 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hello Skip,
9 Jan 2002, 16:45:45, you wrote:
> Gabriel> but this is way too slow.
> How about
> db.execute("SELECT myfield FROM table")
> data=db.fetchall()
> giantstring=[]
> for record in data:
> giantstring.append(record)
> giantstring = "".join(giantstring)
How's that different from
[...]
data=db.fetchall()
data="".join(data)?
which I assume should be way faster as it doesn't need to copy the
data to another list first (which is nice from a memory requirement
point of view as well)?
I was thinking about using that particular solution, but then
mysql-python
wouldn't provide me with fetchall() and fetchallDict() in the same
instance but maybe this works in 0.9.1 to which I just upgraded...
[1]
Best regards,
Gabriel
[1] Might also be my own fault, who knows...
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5i
iQEVAwUBPDxZbMZa2WpymlDxAQGYFgf+PoXTs9UNClU99Wuavz0QS0eyGe/PFmBw
H9vjLw5KBTHvVgj2eTpbAsJTGQTwaZaAD+dR2oC20HpN0PM+ymf06ufvPG6d4CO2
B2micxJ9nDGGgUtrkOhK7W2oyi10ypYh2cCmEWFytjv5fkBz1qSonpIE8Febp2uP
h06qtWLeIOipcVhNhHct7C64Dce5w0bVPzJlRmqJTinubyjjzlWMxWxFsbkiaa85
l6It3hFx6DMrjdgJlZVUwgxDEpQOSN9l9P1FDLKPh64i2QYvJX6oZO7MaZPRQzmC
Y45TkeoV3dysT6bOqpN4gKE3odl4SmjHwdjo5kSskdHOfGHEASLPmQ==
=1R4z
-----END PGP SIGNATURE-----
More information about the Python-list
mailing list