The invention provides a method for estimating top-n cardinal number data in high-speed data flow. The method comprises the following steps that a HyperLogLog Sketch matrix
data structure is defined and set as S, the width is m, the height is n, each element is an HLL counter, and correspondingly, n mutually independent Harsh functions with the Harsh value being 1-m are set as f2, f2, ..., fn; when new data D appears, classification is carried out according to services, and the data D is set as the type X; xi is calculated to be equal to fi(X), wherein I is equal to 1, 2, ..., n; D is reckoned in the HLL counter in S(1, x1), S(2, x2), ..., S(n, xn), updated cardinal numbers, namely, Y1, Y2, ..., Yn are obtained, and an estimated cardinal number Y is obtained; the
data type X and the estimated cardinal number Y are updated into top-n. The method is simple and convenient to use, is achieved parallel through hardware, can be used for calculating the cardinal number of the
data type without storing the
data type and has good safety.