database persistence with mysql, sqlite

coldpizza vriolk at gmail.com
Mon Sep 24 12:19:08 EDT 2007


On Sep 24, 7:23 am, Lawrence D'Oliveiro <l... at geek-
central.gen.new_zealand> wrote:
> In message <1190502677.970811.181... at 22g2000hsm.googlegroups.com>, coldpizza
> wrote:
>
> > So far, with mysql I use 'SELECT * FROM TABLE LIMIT L1, L2' where L1
> > and  L2 define the range for the 'Next' and 'Previous' commands. I
> > have to run the query every time a click a 'Next/Prev' link. But I am
> > not sure that this is the best and most efficient way.

> Try it first, then see what happens. Remember, premature optimization is the
> root of all (programming) evil.

It turned out that the method above ('SELECT * FROM TABLE LIMIT L1,
L2') works ok both with mysql and sqlite3, therefore I have decided to
stick with it until I find something better. With Sqlite3 you are
supposed to use LIMIT 10 OFFSET NN, but it also apparently supports
the mysql syntax (LIMIT NN, 10) for compatibility reasons.




More information about the Python-list mailing list