i do it.. but it's change nothing :(
On 12/24/2010 3:47 PM, Simon Slavin wrote: > On 24 Dec 2010, at 8:17am, Vander Clock Stephane wrote: > >> I have a key like this >> >> 123-098-230-120-111 where (123), (098), (230), (120), (111) are what i >> call node >> Node are integer comprise between 0 and 255 (bytes) > You mean from 000 to 254. 255 breaks your system because you are using > modulus 255. > >> and i need to found "similare" key. >> A similar key is a key where one node is max + - 10 more or lower than >> another node >> >> so >> >> 123-098-230-120-111 >> is similare to >> 120-097-235-118-110 >> >> but not similare to >> 180-197-215-018-010 >> >> it's for our graphical software > Precalculate five sets of minimum and maximum bounds: > > min11 = max((<#randomnumber> % 255)-10,0) > max11 = min((<#randomnumber> % 255)+10,255) > > Then you can just seize the ten values you need from the table and use them > to make up your SELECT command. > > Select > H1.ID > from > HASH1 H1 > where > x1_y1 BETWEEN min11 AND max11 AND > x1_y2 BETWEEN min12 AND max12 AND > x1_y3 BETWEEN min13 AND max13 AND > x1_y4 BETWEEN min14 AND max14 AND > x1_y5 BETWEEN min15 AND max15; > > This will be faster than trying to get SQLite to do the calculations for > every row of your 50 000 000 row table. > > It will work much faster with an index on x1_y1. > It may or may not work faster with an index on > (x1_y1,x1_y2,x1_y3,x1_y4,x1_y5). Try it. > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users