ASENSITIVE is a cursor attribute defined in the SQL standard and implemented by MySQL, MariaDB, and IBM Db2. It appears in DECLARE CURSOR statements inside stored programs. A cursor marked ASENSITIVE may or may not reflect changes made to the base tables after the cursor is opened; the decision is left to the database engine. This differs from INSENSITIVE (guaranteed to use a temporary snapshot and ignore later changes) and SENSITIVE (guaranteed to see committed changes). If no attribute is specified, many systems default to ASENSITIVE. Because behavior is not guaranteed, rely on ASENSITIVE only when your logic is unaffected by whether the cursor sees concurrent updates.
DECLARE CURSOR, INSENSITIVE, SENSITIVE, SCROLL, READ ONLY, FOR UPDATE
SQL:2003 standard; MySQL 5.0
ASENSITIVE leaves the decision about cursor sensitivity to the database engine. The cursor might see or ignore subsequent changes.
Often yes, because the optimizer can choose the cheaper strategy. INSENSITIVE forces a temporary snapshot that can add overhead.
Yes, but behavior still depends on the engine. If the engine treats the cursor as INSENSITIVE internally, rows might not be lockable.
Test by updating a row after opening the cursor and before fetching. If the change appears in the fetched results, the cursor was sensitive.