The Little Guy Posted September 6, 2008 Share Posted September 6, 2008 would doing a mysql query using exec be faster than doing a mysql query with the built in php functions? So... exec("SELECT * FROM tableName;"); // vs. mysql_query("SELECT * FROM tableName"); Would one excel in speed, or would they do about the same? Link to comment https://forums.phpfreaks.com/topic/122954-solved-php-mysql-vs-exec-mysql/ Share on other sites More sharing options...
awpti Posted September 6, 2008 Share Posted September 6, 2008 Um. exec != mysql_query. That is all. Link to comment https://forums.phpfreaks.com/topic/122954-solved-php-mysql-vs-exec-mysql/#findComment-635058 Share on other sites More sharing options...
The Little Guy Posted September 6, 2008 Author Share Posted September 6, 2008 Um... you can run mysql queries using exec. Link to comment https://forums.phpfreaks.com/topic/122954-solved-php-mysql-vs-exec-mysql/#findComment-635173 Share on other sites More sharing options...
Mchl Posted September 6, 2008 Share Posted September 6, 2008 I highly doubt it would be faster. Besides PHP6 is going to have a dedicated mysql driver which should be even faster. http://dev.mysql.com/downloads/connector/php-mysqlnd/ Link to comment https://forums.phpfreaks.com/topic/122954-solved-php-mysql-vs-exec-mysql/#findComment-635230 Share on other sites More sharing options...
PFMaBiSmAd Posted September 6, 2008 Share Posted September 6, 2008 Using exec would be several times slower. Php first has to invoke an instance of the operating system command line processor. The operating system command line processor takes the exec() command line, parses it, and invokes the mysql command line processor. The mysql command line processor parses the sql command(s), formats the low level commands for the mysql server and "calls" the mysql server to execute the commands. Then you must use some slow parsed/tokenized/interpreted php code to parse through the string returned to detect errors or parse through the textual results to get the data into a usable format. Link to comment https://forums.phpfreaks.com/topic/122954-solved-php-mysql-vs-exec-mysql/#findComment-635248 Share on other sites More sharing options...
DarkWater Posted September 6, 2008 Share Posted September 6, 2008 Using exec would be several times slower. Php first has to invoke an instance of the operating system command line processor. The operating system command line processor takes the exec() command line, parses it, and invokes the mysql command line processor. The mysql command line processor parses the sql command(s), formats the low level commands for the mysql server and "calls" the mysql server to execute the commands. Then you must use some slow parsed/tokenized/interpreted php code to parse through the string returned to detect errors or parse through the textual results to get the data into a usable format. Yeah, I mean, parsing the results alone would be several times slower than mysql_query. Link to comment https://forums.phpfreaks.com/topic/122954-solved-php-mysql-vs-exec-mysql/#findComment-635250 Share on other sites More sharing options...
The Little Guy Posted September 6, 2008 Author Share Posted September 6, 2008 Thanks guys! Link to comment https://forums.phpfreaks.com/topic/122954-solved-php-mysql-vs-exec-mysql/#findComment-635324 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.