On Sunday 04 November 2012 22:34:22 Michael Dykman wrote: > A couple of questions present. > > You mention that selecting from the whole table takes 5-10s so I assume you > have a lot of records. Yes, and the calculation of the score is fairly complicated. Plust the test server is slow (Pentium III machine, old, but working) > is the data not in flux? are you sure? Yes, I am. I have a test server, where nothing happens. > these conflict queries are all on the same server? Yes, one mysql instance on one server > > i would have structured the query like so: > select *, udf(column,'value') AS u from table order by u; I tried this and whilst it gives a speedup (around 25%, I would say), it does not solve the problem (but thanks for the hint, I didn't think this makes a difference). > > I suspect it might reduce the number of udf invocations.. the order by > clause is frequently referred to in the process of sorting.. keeping that > static instead of dynamic might sanitize your issue. > > On 2012-11-04 4:24 PM, "Stefan Kuhn" <stef...@web.de> wrote: > > Hi all, > I have a weired (for me at least) problem with a user defined function, > written in C. The function seems to return different results in different > runs (the code of the function does not contain random elements). > Basically, the function calculates a score based on a column in a table and > an input value. So I do something like this: > select * from table order by udf(column, 'input_value') desc; > For my understanding, this should give the same result always. But if I run > many statements (execution is from a java program and I can do it in > parallel > threads) so that they overlap (the udf on a large table takes 5-10 s on a > slow machine), the results of some queries are different. If I have enough > time between statements, it seems to work, i. e. the result is always the > same. I would have thought the statements are independent, even if executed > on different jdbc connections in parallel. > Does somebody have an idea? > Or could somebody give an idea on debugging? Normally I would try to debug > the > code to see what goes on, but how can I do this in a udf? Can I log in the > udf? > Thanks for any hints, > Stefan > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql