V
V
vstas2014-08-28 12:41:26
PHP
vstas, 2014-08-28 12:41:26

PHP (including me) can't get "large" data from Mssql stored procedure?

The question is. There is a need to get big data in PHP(5.3.3) from mssql.
On the mssql server, a stored procedure was created (not by me and not all the details are fully known, but you can query it), approximately like this:

CREATE PROCEDURE <Имя процедуры>
 @ID int
,@TimeStart datetime
,@TimeEnd datetime
,@Param varchar(200)
,@Language_Name varchar(30)
,@IsShow bit = 0

* * * * черный для меня ящик * * * *

Perhaps I was not informed, but this procedure also has OUTPUT parameters.
The main problem for me is that the procedure can return a lot of data. PHP runs out of memory and everything is "finalized".
The most annoying thing is that the memory runs out during this call, which is strange for me:
$result = mssql_query($query, $conn);
Ie . before it, 2MB of memory is used, and during this call we fly out of an overrun of 512MB. (I would really hate to put -1 for the memory limit in php)
This is the question I wanted to ask for help answering those who are familiar with this or have some thoughts on this matter.
Am I understanding the process correctly? The mssql_query call sends a query to the Microsoft SQL server, a procedure with the specified name is launched, SQL statements are executed, and OUTPUT variables are filled along the way. And I am told the resource identifier with which I can pull out (mssql_fetch_array) the data already to myself?

Perhaps some data is read from the OUTPUT variables already when mssql_query is called, but they are already large and do not fit into memory?
How does PHP parse all this and could it be related to OUTPUT variables?
Tried to get data using PDO. The same problem, but already when calling $stmt->execute();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2014-08-28
@maxru

Yes, at the time of calling the mssql_query function or the PDO::execute method, the fetch data is loaded into memory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question