>>> Is there anything I can do to reduce the time taken?

>  > < Simon correctly advised >
>  > Do it in your favourite programming language rather than SQL.

> Let me be even more clear :

>      Memory is cheap and most servers have plenty.

>      Processors are fast and most servers have multiple with many cores.

>      Select the entire table of columns you need into memory.
>      Write a little code.

> No it won't scale very well into millions of rows but I could easily run
> a test and I will bet many mnay many dollars that processing the sums in
> memory is orders of magnitude faster than SQL.

You shouldn't even need to read the entire table (or view) into
memory: just read row-by-row, and for each field, keep a running
total and the count of non-NULL values. From these you can calculate
your total and both types of average.

Graham



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to