I am confused regarding MySQLdb server side pointer and client cursor

I am using python-mysql (MySQLdb) to query the Mysql server. There are two cursor modules: one is the client cursor, for example:

cursor = db.cursor(MySQLdb.cursors.DictCursor)

Another is a server-side cursor, for example:

cursor = db.cursor(MySQLdb.cursors.SSDictCursor)

Doc says a server-side cursor means that Mysql caches some results on the server side of mysql and then sends them to the client. I'm so confused about this, let's say if I want to kill one mysql server, I could just use a few server side cursors and then mysql will be dead due to out of memory. Also, does the server size cursor make sense? The default mechanism of Mysql is that when mysql retrieves a single record, it immediately sends it to the client. Does it make sense to cache the results and then send them?

I really don't know which cursor I should use, the server side cursor or cursor?

+4
source share
3 answers

, MySQL , - .

, . , , , , , , , . , .

, , , - , , , .

, . , , . .

+1

:

  • , .

, :

, , :

SELECT * FROM sometable;

MySQL ( ) , . , InnoDB ACID .

- , :

SELECT * FROM sometable ORDER BY a,b,c;

In this case, MySQL (and again most other DBMSs) must first retrieve all the data in the correct order. To do this, a temporary table will be created on disk at #tmp. This can lead to the fact that the disk will be full (in most cases translated as out of memory) problems and loss of connection. However, MySQL continues to work.

+1
source

Source: https://habr.com/ru/post/1615844/


All Articles