Convert string to command..

Peter Otten __peter__ at web.de
Fri Oct 19 10:50:57 CEST 2007


Abandoned wrote:

> I'm very confused :(
> I try to explain main problem...

That's always a good first step; try to remember that when you start
your next thread.

> I have a table like this:
> id-1 | id-2 | value
> 23     24       34
> 56     68       66
> 56     98       32455
> 55     62       655
> 56     28       123
> .... ( 3 millions elements)
> 
> I select where id=56 and 100.000 rows are selecting but this took 2
> second. (very big for my project)
> I try cache to speed up this select operation..
> And create a cache table:
> id-1 | all
> 56    {68:66, 98:32455, 62:655}
> 
> When i select where id 56 i select 1 row and its took 0.09 second but
> i must convert text to dictionary..

Before you go on with your odd caching schemes -- is the database properly
indexed? Something like

CREATE UNIQUE INDEX mytable_id1_id2 ON mytable (id-1, id-2);

(actual syntax may differ) might speed up the lookup operation
enough that you can do without caching.

Peter



More information about the Python-list mailing list