[Tutor] data sharing

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Wed Apr 16 21:38:02 2003


On Tue, 15 Apr 2003 nano@intermatik.co.id wrote:

> Hi pythonmania,
>
> Thanks for many advices you've given in my previous problem [list
> comprehension].
>
> Now, StraightToProblem: I have an object "Class_A" that get a big data
> from MySQL to do search/sort etc. How can I share that data, so that if
> other object "Class_B", "Class_C" need the same data, they can use it,
> without have to call it from MySQL.


Hi Nano,

A tangent question: just to make sure, when you say "big data", do you
mean that the string in your database is huge, or do you mean that the
table itself has many rows that make searching for a row very slow?

If it's the latter, then you may want to check that your table is
"indexed":

    http://www.mysql.com/doc/en/MySQL_indexes.html

If your tables are not indexed, adding an appropriate column index may
speed up your object construction dramatically.  In some cases, it may
speed it so much that you may not need to worry so much about keeping
search results in memory.


Good luck to you!