1.Dd January 24, 2024 2.Dt SQLITE_SCANSTAT_NLOOP 3 3.Os 4.Sh NAME 5.Nm SQLITE_SCANSTAT_NLOOP , 6.Nm SQLITE_SCANSTAT_NVISIT , 7.Nm SQLITE_SCANSTAT_EST , 8.Nm SQLITE_SCANSTAT_NAME , 9.Nm SQLITE_SCANSTAT_EXPLAIN , 10.Nm SQLITE_SCANSTAT_SELECTID , 11.Nm SQLITE_SCANSTAT_PARENTID , 12.Nm SQLITE_SCANSTAT_NCYCLE 13.Nd prepared statement scan status opcodes 14.Sh SYNOPSIS 15.In sqlite3.h 16.Fd #define SQLITE_SCANSTAT_NLOOP 17.Fd #define SQLITE_SCANSTAT_NVISIT 18.Fd #define SQLITE_SCANSTAT_EST 19.Fd #define SQLITE_SCANSTAT_NAME 20.Fd #define SQLITE_SCANSTAT_EXPLAIN 21.Fd #define SQLITE_SCANSTAT_SELECTID 22.Fd #define SQLITE_SCANSTAT_PARENTID 23.Fd #define SQLITE_SCANSTAT_NCYCLE 24.Sh DESCRIPTION 25The following constants can be used for the T parameter to the sqlite3_stmt_scanstatus(S,X,T,V) 26interface. 27Each constant designates a different metric for sqlite3_stmt_scanstatus() 28to return. 29.Pp 30When the value returned to V is a string, space to hold that string 31is managed by the prepared statement S and will be automatically freed 32when S is finalized. 33.Pp 34Not all values are available for all query elements. 35When a value is not available, the output variable is set to -1 if 36the value is numeric, or to NULL if it is a string (SQLITE_SCANSTAT_NAME). 37.Bl -tag -width Ds 38.It SQLITE_SCANSTAT_NLOOP 39The sqlite3_int64 variable pointed to by the V parameter 40will be set to the total number of times that the X-th loop has run. 41.It SQLITE_SCANSTAT_NVISIT 42The sqlite3_int64 variable pointed to by the V parameter 43will be set to the total number of rows examined by all iterations 44of the X-th loop. 45.It SQLITE_SCANSTAT_EST 46The "double" variable pointed to by the V parameter will be set to 47the query planner's estimate for the average number of rows output 48from each iteration of the X-th loop. 49If the query planner's estimates was accurate, then this value will 50approximate the quotient NVISIT/NLOOP and the product of this value 51for all prior loops with the same SELECTID will be the NLOOP value 52for the current loop. 53.It SQLITE_SCANSTAT_NAME 54The "const char *" variable pointed to by the V parameter will be set 55to a zero-terminated UTF-8 string containing the name of the index 56or table used for the X-th loop. 57.It SQLITE_SCANSTAT_EXPLAIN 58The "const char *" variable pointed to by the V parameter will be set 59to a zero-terminated UTF-8 string containing the EXPLAIN QUERY PLAN 60description for the X-th loop. 61.It SQLITE_SCANSTAT_SELECTID 62The "int" variable pointed to by the V parameter will be set to the 63id for the X-th query plan element. 64The id value is unique within the statement. 65The select-id is the same value as is output in the first column of 66an EXPLAIN QUERY PLAN query. 67.It SQLITE_SCANSTAT_PARENTID 68The "int" variable pointed to by the V parameter will be set to the 69the id of the parent of the current query element, if applicable, or 70to zero if the query element has no parent. 71This is the same value as returned in the second column of an EXPLAIN QUERY PLAN 72query. 73.It SQLITE_SCANSTAT_NCYCLE 74The sqlite3_int64 output value is set to the number of cycles, according 75to the processor time-stamp counter, that elapsed while the query element 76was being processed. 77This value is not available for all query elements - if it is unavailable 78the output variable is set to -1. 79.El 80.Pp 81.Sh IMPLEMENTATION NOTES 82These declarations were extracted from the 83interface documentation at line 10143. 84.Bd -literal 85#define SQLITE_SCANSTAT_NLOOP 0 86#define SQLITE_SCANSTAT_NVISIT 1 87#define SQLITE_SCANSTAT_EST 2 88#define SQLITE_SCANSTAT_NAME 3 89#define SQLITE_SCANSTAT_EXPLAIN 4 90#define SQLITE_SCANSTAT_SELECTID 5 91#define SQLITE_SCANSTAT_PARENTID 6 92#define SQLITE_SCANSTAT_NCYCLE 7 93.Ed 94.Sh SEE ALSO 95.Xr sqlite_int64 3 96