SQL_BIG_RESULT
Example
Section titled “Example”SELECT SQL_BIG_RESULT product_id, SUM(price) as total_priceFROM product_salesGROUP BY product_id;Output
Section titled “Output”+------------+--------------+| product_id | total_price |+------------+--------------+| 1 | 5000 || 2 | 3000 || 3 | 7000 |+------------+--------------+Explanation
Section titled “Explanation”The given example uses SQL_BIG_RESULT to modify the SELECT statement. This instruction is used when a large amount of data is expected in the result set. With SQL_BIG_RESULT, MySQL directly uses disk-based temporary tables to store the result set, optimizing for situations where the result data is larger than memory. The example calculates the sum of prices (total_price) for each product_id in the product_sales table.