To realize rapid inquiry of the dispensing results in prescription dispensing subsystem. SQL statement tracer was used to determine corresponding SQL statement, and the executive plan was analyzed to find the desired table. Proper indexes were established to enhance the efficiency of the inquiry statement. The optimization of SQL statements made the executive efficiency increased greatly without the need for hardware upgrade. The analysis on the executive plan of the dispensing inquiry statements and the indexes on corresponding tables increases the prescription dispensing inquiry speed while decrease the waiting time of the staff.