Hello Richard, On 16/03/13 13:50, Richard Siebeling wrote:
I querying my database using a script in PHP and returning the result as a JSON (so that it can be retrieved in Javascript).
However I notice that querying the database (sending the query to the database) takes about half the time if takes PHP to retrieve the rows (row by row using monetdb_fetch_object). Interestingly, the PHP connector already reads back the entire query response in the call to mapi_execute. Hence, the timings you observed seem to be only caused by calls to monetdb_fetch_object and json_encode, which do not talk to the database. There is no need for a fetchall()-method here.
How could you speed this up? Well, first it would be interesting which of the two calls actually take the time. If it is json_encode, you could try another method of encoding JSON, possibly with another library. If it is monetdb_fetch_object() the first, you could use another connector, e.g. JDBC or the C MAPI library. Best, Hannes