Hi,
I have a huge table (2 million records) which have fields that need to be compared to each other in another table.
These fields must use a comparison function (which i coded as mysql UDF extension). The comparison function itself is quite fast, but, I cannot create an index on the function.
table1:
id, staticdata, data
table2:
id, staticdata, data
query:
SELECT table1.id, table2.id FROM table1 LEFT JOIN table2 ON ( table1.staticdata = table2.staticdata ) WHERE mycompare(table1.data, table2.data) > 90;
id is primary key and staticdata has indexes
1 result takes 0.1s
2 results take 50s
100 result take days
etc
if i code this without MySQL results are 10000x faster. However i would like to use the database functionalities. But taking days instead of minutes, is a show stopper of course
Or should i switch to postgres sql to create an index on the “mycompare” function?
Due to the size of the table, im unable to run mycompare separatly and store results.it would take too much space (and table wouldnt fit in memory anyway)