A data indexing apparatus, comprising a creation module, a plotting module and a fitting module,
- wherein the creation module is configured to create, in order of field values of preset fields within a plurality of data records corresponding to a data file, a clustered index for the data file, with the data records having a different positional offsets in the data file;
- the plotting module is configured to plot, for the plurality of data records in the data file, distribution of positional offsets corresponding to the field values;
- and
- the fitting module is configured to perform curve-fitting on distribution of the positional offsets corresponding to the respective field values to obtain a fitting function, so as to determine a positional offset according to field value(s) of preset field(s) in a data record to be queried, and then acquire the data record according to the determined positional offset wherein the curve-fitting comprises:
- performing curve-fitting on the distribution of positional offsets corresponding to a plurality of field values to obtain a fitting function;
- calculating a positional offset for each data record by the fitting function;
- determining that the fitting function satisfies a preset condition when deviation values are all smaller than a preset threshold, with each deviation value between an actual positional offset and a calculated positional offset corresponding to one of the plurality of data records, and keeping the fitting function;
- determining respective actual positional offsets and field values corresponding to the actual positional offsets if the fitting function fails to satisfy the preset condition;
- judging, in the individual determined field values, whether there is a situation that a difference value between any two adjacent field values is greater than a preset jump threshold;
- and
- inserting a blank record in the data file, if there is the situation that a difference value between any two adjacent field values is greater than a preset threshold, with the blank record between the two adjacent field values which have a difference value greater than the preset threshold, so that the actual positional offset corresponding to the larger field value in the two adjacent field values varies, and further so that the positional offsets corresponding to respective field values and the inserted blank record are subjected to fitting, to obtain a fitting function, with the fitting function satisfying the preset condition.