Logarithm function in sqlite query?

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.

Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 后端存储 » Logarithm function in sqlite query?

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录