ID: 37912 Updated by: [EMAIL PROTECTED] Reported By: dangerousdave86 at hotmail dot com -Status: Open +Status: Feedback Bug Type: SQLite related Operating System: Windows XP SP2 + Apache 2 PHP Version: 5.1.4 New Comment:
Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. Previous Comments: ------------------------------------------------------------------------ [2006-06-26 05:48:00] dangerousdave86 at hotmail dot com Description: ------------ My simple, expandable query doesn't like being simple in PHP5.1.4, or 5.1.2. "SELECT files.file_location AS file_location, files.file_id AS file_id, count(files.file_id) AS count FROM (SELECT file.file_location AS file_location, file.file_id AS file_id FROM property INNER JOIN file ON (file.file_id = property.file_id) WHERE (property.value LIKE '%sometext%')) AS files GROUP BY files.file_id ORDER BY count DESC" This query takes 7 seconds to execute in PHP, but returns instantly with results from the SQLite executable. SQLite3.exe. I am using the PDO SQLite for access to version 3 databases. when extending the query with an extra sub-query, the query suddenly executes in milliseconds. "SELECT files.file_location AS file_location, files.file_id AS file_id, count(files.file_id) AS count FROM (SELECT file.file_location AS file_location, file.file_id AS file_id FROM property AS property INNER JOIN file AS file ON (file.file_id = property.file_id) WHERE (property.value LIKE '%sometext%') UNION SELECT file.file_location AS file_location, file.file_id AS file_id FROM property AS property INNER JOIN file AS file ON (file.file_id = property.file_id) WHERE (property.value LIKE '%sametext%')) AS files GROUP BY files.file_id ORDER BY count DESC" I can't see how this is happening. The query is generated, so there are no typos or differences between SQL. The derived tables are identical. There are reasons behind why the SQL is laid out as it is and I'm not using ORs. But anyway, this behaviour is most unusual, and like I say, not reproducable from the SQLite command line. The first query executes in roughly 7 seconds, while the second executes in 1/100th of a second. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37912&edit=1