1. An extraction method of extracting, as a conversion object, a sub query to be converted to a program for processing stream data continuously inputted to a database, from a query including one or more instructions as sub queries to be issued to a database management system for managing the database, the method comprising the steps of: receiving input of the query, a maximum memory increase amount of a memory whose use amount increases with the processing of the stream data, and a lower limit value of efficiency as processing time per unit memory increase amount, the processing time being reduced in a case where the stream data is processed by the program compared to a case where the database management system executes the query; calculating by a computer processor at least one memory increase amount in a case where each sub query included in the query is converted to the program and then the stream data is processed and the processing time to be reduced in a case where the stream data is processed compared to the case of execution by the database management system, and calculating the efficiency by using the at least one calculated memory increase amount and the processing time to be reduced; and selecting at least one sub query whose calculated efficiency is equal to or higher than the lower limit value, integrating the memory increase amount calculated for the selected sub query, and extracting the selected sub query as a conversion object on condition that the integrated memory increase amount is equal to or smaller than the maximum memory increase amount.