Hi,

I'm playing with parallization of databases and I am a little confused about my result on MonetDB.
Scenario: 15 Millions of Entries and i want to find the number of entries where the attributes are in a certain sector (i know, a simple select would do the work but i wanted a simple example)

i have java code that get all 15 Mio. Data from the database via JDBC and iterates over them with a loop without multithreading. --> 13 ms

then i created a stored function:

CREATE FUNCTION isInRangexy(x DECIMAL(10,7), y DECIMAL(10,7)) RETURNS BOOL 
BEGIN ATOMIC
IF x > 50 AND y < 50 THEN
RETURN true;
ELSE
RETURN false;
END IF;
END

Then I call it with: SELECT COUNT(*) FROM location WHERE isInRange(x,y)

It works, but it is more than 3 times slower than the first java option. I had thought i would get benefit from the fact that i don't need to transfer all the data to the application and of some parallelization and other optimization from monetdb. 

Did I made a mistake? Can I use another example to get the anticipated results?

thanks,
michael