Data storage and query method and device are disclosed, which facilitate a quick acquisition of query results through index queries at subsequent stages by establishing indexes for columns of a table. Furthermore, by scanning data in the table to obtain statistical information of data in the columns, this facilitates using the statistical information of the data in the columns to perform cost estimation in subsequent queries, in an attempt to obtain a data query mode that has the least cost and the best performance, thus improving query efficiency.