Groups | Search | Server Info | Login | Register
Groups > comp.lang.tcl > #55672
| From | Rich <rich@example.invalid> |
|---|---|
| Newsgroups | comp.lang.tcl |
| Subject | Re: Optimal used of sqlite |
| Date | 2026-04-29 15:50 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <10st9d0$156i$1@dont-email.me> (permalink) |
| References | <10st8ah$14ekd$1@tota-refugium.de> |
meshparts <alexandru.dadalau@meshparts.de> wrote:
> I'm writing numerical lists to a sqlite DB and I'm wondering, if the way
> I do it is the fastest possible, since the lists are pretty large and it
> seems that most of the processing time is spent on writing the data to
> the DB instead on the actual computation of the lists.
>
> So I currently do:
>
> sqlite3 db $rstfile2
> db eval {CREATE TABLE general(key TEXT, data TEXT)}
> db eval {CREATE TABLE results(key TEXT, data TEXT)}
> db eval "INSERT INTO general VALUES('dt','$dt')"
> db eval "INSERT INTO general VALUES('nsteps','$nsteps')"
>
> db eval "INSERT INTO results VALUES('$step-global','$Im')"
This causes Tcl to create a string, containing the string rep of the
list, and then causes sqlite to reparse the SQL string to extract that
string therefrom.
Use sqlite's ability to directly address Tcl variables instead:
db eval {INSERT INTO results VALUES($step-global,$Im);}
And you may find that the time to insert goes down by some factor.
> Here, the list "Im" is the large list.
Care to define what "llength" constitutes "large" for you?
> Is this already optimal of are there some tricks to make it much faster?
>
> Many thanks
> Alex
Back to comp.lang.tcl | Previous | Next — Previous in thread | Next in thread | Find similar
Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-29 17:32 +0200
Re: Optimal used of sqlite Rich <rich@example.invalid> - 2026-04-29 15:50 +0000
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-29 19:13 +0200
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-29 19:44 +0200
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-29 19:58 +0200
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-29 20:06 +0200
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-29 23:29 +0200
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-29 23:50 +0200
Re: Optimal used of sqlite rene <user4652@newsgrouper.org.invalid> - 2026-04-30 09:22 +0000
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-30 11:43 +0200
Re: Optimal used of sqlite rene <user4652@newsgrouper.org.invalid> - 2026-04-30 13:09 +0000
Re: Optimal used of sqlite Ralf Fassel <ralfixx@gmx.de> - 2026-04-30 15:35 +0200
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-30 15:49 +0200
Re: Optimal used of sqlite Rich <rich@example.invalid> - 2026-04-29 21:56 +0000
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-30 00:12 +0200
Re: Optimal used of sqlite Rich <rich@example.invalid> - 2026-04-29 22:22 +0000
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-30 08:00 +0200
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-30 08:34 +0200
Re: Optimal used of sqlite Ralf Fassel <ralfixx@gmx.de> - 2026-04-30 14:38 +0200
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-29 19:15 +0200
Re: Optimal used of sqlite Rich <rich@example.invalid> - 2026-04-29 21:54 +0000
Re: Optimal used of sqlite meshparts <alexandru.dadalau@meshparts.de> - 2026-04-30 00:08 +0200
Re: Optimal used of sqlite Julian Bradfield <jcb@inf.ed.ac.uk> - 2026-04-30 10:25 +0000
csiph-web