1Z0-909 practice question 12 of 15

You are using buffered queries with PHP mysqli in a browser-based web application. Which three are true?

Full set: 65 questions
Answer options
A:

A. Additional queries on the same session are blocked until the result set is released.

B:

B. Results are sent from the server to the browser for buffering.

C:

C. Buffered queries are enabled by default.

Correct answer
D:

D. Buffered queries should be used on large tables when the result size is unknown.

E:

E. Results are sent to the calling PHP process for buffering.

Correct answer
F:

F. Buffered queries must be explicitly enabled using mysqliuseresult.

G:

G. Large results can have a negative impact on performance.

Correct answer
Correct Answer:
C. C. Buffered queries are enabled by default.; E. E. Results are sent to the calling PHP process for buffering.; G. G. Large results can have a negative impact on performance.
Explanation

In MySQLi the default behaviour of mysqliquery() is MYSQLISTORERESULT, which is a buffered-result mode. Buffered mode moves the complete result set from the MySQL server to the client (the PHP process) and stores it in the client’s memory; nothing is sent directly to the browser. Because the entire set is copied, very large results increase network traffic and can consume large amounts of PHP memory, degrading performance.

Why Incorrect

A. Blocking the next statement until the current result is released applies to unbuffered mode (mysqliuseresult), not to the default buffered mode.
B. Data are transferred to the PHP client, not to the browser.
D. For an unknown or very large result, unbuffered mode is recommended to avoid high memory use; buffered mode is not “should” in this case.
F. mysqliuseresult() activates UNbuffered mode; buffered mode needs no explicit call.

References

1. PHP Manual – “mysqli quickstart: buffered result sets”, § Introduction, para 1-2 (php.net/manual/en/mysqli.quickstart.buffered.php)

2. PHP Manual – “mysqliuseresult”, Remarks, para 1-2 (php.net/manual/en/mysqli.use-result.php)

3. MySQL 8.0 Reference Manual – “C API Example Programs / mysqlstoreresult()”, § 23.8.6.10, para 1-3 (Oracle, 2023)

4. MySQL 8.0 Reference Manual – “Buffering Results”, § 23.8.5, para 1 (Oracle, 2023)

Scroll to Top