The invention discloses a method for
lossy compression in a real-time
database through
dynamic prediction. According to the steps of the method,
system initialization is carried out, two real-
time data are read in, the first datum is written into the
database and is saved as 'the final read-in datum', and according to the former two data and the error permitted range, the top and bottom limitation of a
slope factor is calculated, and each modification value is initialized as zero; new data are read in, and the top and bottom limitation of the
slope factor is calculated according to the new data, 'the final read-in datum' and the error permitted range; the top and bottom limitation of the
slope factor of the new data and the top and bottom limitation of the current slope factor are compared to determine whether the new data are saved; and the top and bottom limitation of the current slope factor and a slope factor modification value are adjusted, and the second step is repeated. The invention discloses a decompression method for
lossy compression in the real-time
database through
dynamic prediction. The decompression method for
lossy compression in the real-time database through
dynamic prediction includes the following steps: query time is set as t, the latest three data p1(t1,v1), p2(t1,v2) and p3(t3,v3) before the t are read in, and then pt (t,vt) is calculated in the following calculating method. Compared with the existing calculation, the methods for lossy compression and decompression in real-time database through dynamic prediction have the advantages of being large in
compression ratio, small in error, and the like.