The invention discloses a method and device for inquiring data. The method comprises the steps that an inquiry statement is decomposed into one or more inquiry clauses; traversal is carried out on the inquiry clauses, the inquiry clauses are matched with metadata, and the inquiry clauses are replaced with execution results stored in the metadata; otherwise, the inquiry clauses are executed, and the metadata are updated; the final execution result is used for main inquiry to obtain an inquiry result. The executed inquiry clauses and the execution results of the executed inquiry clauses are used as the metadata to be managed, the identical inquiry clauses in the current session or different sessions are directly replaced with the execution results stored in the metadata, the inquiry clauses are prevented from being executed repeatedly, and therefore the inquiry performance of the whole system is improved to a greater extent. Meanwhile, compared with optimization of the existing inquiry clause level, the inquiry optimization granularity is thinner, the method and device are more suitable for inquiring large data in data warehouse application, and therefore the inquiry performance of the whole system is further improved.