Re: [sqlite] Sqlite, Is it possible to calculate the length of the longest increasing subsequence using an UDF?

2012-10-13 Thread Elefterios Stamatogiannakis

Sorry for hijacking the thread, but i have an answer for that.

IMHO having the computation application and the data management on 
different domains incurs a very high data transfer cost.


The traditional thinking of shipping the data from the DB to somewhere 
else (application code) to do the computation and then shipping the 
result back to the DB is putting an enormous overhead on data processing 
tasks that need to do this back and forth shipping many times. Even when 
using SQLite that lives on the same process as the computation 
application, this overhead is *very* considerable.


By moving the computation closer/inside the DB engine (with UDFs), this 
overhead vanishes. I have already seen many cases of people implementing 
workflows the traditional way (DB server, computation on the app. 
server) on high powered machines, being several times slower than me 
doing the same processing using madIS [*] on my low powered desktop.


All of the above apply for OLAP processing. For OLTP, the traditional 
approach is good enough.


lefteris.

[*] http://code.google.com/p/madis/

On 12/10/12 21:41, Igor Tandetnik wrote:

... In light of this, I don't quite see what you expect to gain from turning it
into a UDF, as opposed to simply loading the sequence from the database
into memory with a vanilla SELECT statement, and working on it in your
application code.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Sqlite, Is it possible to calculate the length of the longest increasing subsequence using an UDF?

2012-10-12 Thread Igor Tandetnik

On 10/12/2012 11:23 AM, Frank Chang wrote:

With the latest version of Sqlite, Is it possible to calculate the length
of the longest increasing subsequence, also referred to as sortation
percent, using a sqlite UDF, user defined function? Thank you.


An algorithm described at

http://en.wikipedia.org/wiki/Longest_increasing_subsequence#Efficient_algorithms

should be possible to implement in the form of a user-defined aggregate 
function, if that's what you are asking.


The algorithm is O(n) space - that is, it needs to store substantial 
portions of the sequence (the whole sequence, in the worst case). In 
light of this, I don't quite see what you expect to gain from turning it 
into a UDF, as opposed to simply loading the sequence from the database 
into memory with a vanilla SELECT statement, and working on it in your 
application code.


What's the ultimate goal of the exercise, if you don't mind me asking?
--
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Sqlite, Is it possible to calculate the length of the longest increasing subsequence using an UDF?

2012-10-12 Thread Frank Chang
With the latest version of Sqlite, Is it possible to calculate the length
of the longest increasing subsequence, also referred to as sortation
percent, using a sqlite UDF, user defined function? Thank you.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users