PHP with MSSQL performance

I'm developing a project where I need to retrieve HUGE amounts of data from an MsSQL database and treat that data. The data retrieval comes from 4 tables, 2 of them with 800-1000 rows, but the other two with 55000-65000 rows each one.

The execution time wasn't tollerable, so I started to rewrite the code, but I'm quite inexperienced with PHP and MsSQL. My execution of PHP atm is in localhost:8000. I'm generating the server using "php -S localhost:8000".

I think that this is one of my problems, the poor server for a huge ammount of data. I thought about XAMPP, but I need a server where I can put without problems the MsSQL Drivers to use the functions.

I cannot change the MsSQL for MySQL or some other changes like that, the company wants it that way...

Can you give me some advices about how to improve the performance? Any server that I can use to improve the PHP execution? Thank you really much in advance.


The PHP execution should least of your concerns. If it is, most likely you are going about things in the wrong way. All the PHP should be doing is running the SQL query against the database. If you are not using PDO, consider it:

First look to the way your SQL query is structured, and how it can be optimised. If in complete doubt, you could try posting the query here. Be aware that if you can't post a single SQL query that encapsulates your problem you're probably approaching the problem from the wrong angle.

I am assuming from your post that you do not have recourse to alter the database schema, but if so that would be the second course of action.

Try to do as much data processing in SQL Server as possible. Don't do data joining or other type of data processing that can be done in the RDBMS.

I've seen PHP code that retrieved data from multiple tables and matched lines based on several conditions. This is just an example of a misuse.

Also try to handle data in sets in SQL (be it MS* or My*) and avoid, if possible, line-by-line processing. The optimizer will output a much more performant plan.

This is small database. Really. My advices: - Use paging for the tables and get data by portions (by parts) - Use indexes for tables - Try to find more powerful server. Often hosters companies uses one database server for thousands user's databases and speed is very slow. I suffered from this and bought dedicated server finally.

Need Your Help

Execute tf.exe (TFS) from C# halts

c# tfs processstartinfo

I need to get the revision number from TFS, if i run tf.exe from a Process the process halts. If i run the same command from command promts it works?

jQuery spinner type thing

jquery drop-down-menu spinner increment

I'm trying to create a jQuery spinner type thing earlier today somebody gave me this code which increases the text field value up/down on button clicks. Fantastic. But what do you do to disable the...