| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #3 (permalink) |
| Account Suspended Join Date: May 2007
Posts: 163
![]() ![]() ![]() | This is a good question and it would depend on a few considerations, For most general use, the times would be negligible. SQL code would be faster when math operations have to be done repeatedly to large datasets, and for processing data and adding it back into the database. Part of this involves the fact that large datasets dont need to be transferred to the application/application memory. MySQL i optimized to process data on the db like this, other db's have procedures, etc. ????: NamePros.com http://www.namepros.com/programming/590430-math-using-mysql-or-php.html Operations that involve storing the results for further processing, and that need to be really dynamic would be best in PHP code, things such as integrals, fatorials, amortization tables etc. The caveat to SQL code is that its sometimes more complex than just using PHP, and unless you're beyond needing to process tens of thousands of rows, you probably wont see any speed gains. +1 for PHP |
| | |
| | THREAD STARTER #4 (permalink) |
| NamePros Member Join Date: Nov 2003 Location: Ontario, Canada
Posts: 127
![]() ![]() | Thanks for the responses. Here is the SQL I am working with: Code: select country.name, IFNULL(unverified,0) as unverified, IFNULL(verified,0) as verified, IFNULL(format(verified/(IFNULL(unverified,0)+verified)*100,2),'N/A') as average, IFNULL(verified + IFNULL(unverified,0),'N/A') as total from country left join (select count(*) as verified,country.countryID from school left join city using(cityID) left join province using(provinceID) left join country using(countryID) where status = 1 group by country.name order by country.name) as t1 using(countryID) left join (select count(*) as unverified,country.countryID from school left join city using(cityID) left join province using(provinceID) left join country using(countryID) where status = 0 group by country.name order by country.name) as t2 using(countryID) |
| | |
| | #6 (permalink) |
| Domains my Dominion Join Date: Aug 2005 Location: Web 1.0
Posts: 9,558
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | IMO the performance hit will be the multiple joins. I hope you have good indexes. Perhaps the whole statement could be optimized.
__________________ NameNewsletter.com - free lists of available domain names ZoneFiles.net (beta) - ccTLD and gTLD droplists |
| | |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HOWTO: Install the Apache Web Server, Perl, PHP, and MySQL on Windows | deadserious | Webmaster Tutorials | 96 | 05-27-2007 02:24 PM |
| Great Scripts for Sale With Resale Rights! | Zeeble | Scripts For Sale | 20 | 01-04-2006 02:39 AM |