I really need to perform an update on over 400,000 rows using the logarithm function. Unfortunately, the SQL logarithm function does not seem to exist in sqlite. Is there any way I can derive the logarithm function or import the LOG function?
The only other way I know how to do this is I believe order O(n^2) through python. This approach will take too long (I tried, it took about and 1.5 hours to go through 6% on my slow computer).
EDIT:
I also found out why it took so long. The primary key in the database was not marked as a primary key. So the code that I was using followed:
for row in database:
...calculations for the row...
...sql update for the specific row which follows:...
for search_row in database:
if search_row[id] = row[id]:
...update values here...
Incredibly inefficient… O(n^2)
There is no built-in logarithm function; you have to define your own function.
If you’re using Python, this is possible with both the pysqlite and APSW modules.