Help me with this code PLEASE

Denis McMahon denismfmcmahon at gmail.com
Tue Nov 5 19:45:08 EST 2013


On Wed, 06 Nov 2013 00:35:56 +0200, Nick the Gr33k wrote:

> Now i realizes i just cannot store lists into it's columns because it
> does not support a collection datatype.

All databases support storing of collections, but *NOT THE WAY YOU WANT 
TO DO IT*

You refuse to do it the proper way, so you have to bodge a solution .... 
oh wait .... I'm having a flashback here ....

You have been told several times by several people how to do this 
properly. You insist on using your bodged up solution instead. OK, we'll 
all try and help you bodge up a solution, but I will tell you now, in 
advance, in very clear terms:

*ONE DAY YOUR BODGED UP SOLUTION WILL BREAK BECAUSE THE TOTAL LIST OF 
TORRENTS THAT A USER HAS DOWNLOADED, WHEN PACKAGED INTO A STRING, WILL BE 
BIGGER THAN THE DATABASE STRING FIELD YOU ASSIGNED*

There may be another issue that you need to consider.

Supposing a torrent file name is 40 characters long. Supposing a user 
downloads up to 20 torrents a day. That means in one year, their list 
will contain 7300 entries, and the character string in the database will 
be 365 * 20 * 40 + 365 * 20 - 1 = 299299 characters.

And you're going to convert this huge string into a list and then back 
into a string 20 times a day for every user just to add another 40 
characters to the end.

Do you expect 100 users? 1,000? 10,000? 100,000?

Let's assume that you have a million users. In a year, every day you're 
reading and writing about 6000 Gbytes a day from and to the database.

Holy smoke batman, that's a lot of data.

Or you could use the database properly, and just write the 40 byte 
torrent file name to the database with a pointer to the user's record 
every time a user downloads another torrent.

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list