for fast searching table , need separate large table 2 tables example table:
+--------+--------+-------+------+ | source | target | count | prob | +--------+--------+-------+------+ | test1 | test2 | 2 | 1 | | cat | dog | 3 | 1.5| | dog | cat | 1 | 0.5| +--------+--------+-------+------+
using code below
insert table2 (source,target,count,prob) select source,target,count,prob table1 count <2;
then delete originals
delete table1 count<2;
and count grouping after separating table in table1, , new same element increase after separating.
for example:
source = 'dog' , target = 'cat' , count = 1
move table2 , table1 still grouping add count or add new row source = 'dog' target ='cat'
, count = 3
.
how combine table1 , table2 (table2 not change after separating)
you can combine result union
select source, target, count, prob tbl1 union select source, target, count, prob tbl2
just note there lots of better ways better performance on large tables
Comments
Post a Comment