display iostats
https://www.lianja.com/doc/index.php/DISPLAY_IOSTATS
list iostats
https://www.lianja.com/doc/index.php/LIST_IOSTATS
profile do myapp display profile
https://www.lianja.com/doc/index.php/DISPLAY_PROFILE
profile myapp list profile to file profile.txt vi profile.txt
https://www.lianja.com/doc/index.php/LIST_PROFILE
// Program to tidy up on exit of application clear fcache
https://www.lianja.com/doc/index.php/CLEAR_FCACHE
clear iostats
https://www.lianja.com/doc/index.php/CLEAR_IOSTATS
set profile on profile myapp list profile to file profile.txt vi profile.txt clear profile
https://www.lianja.com/doc/index.php/CLEAR_PROFILE
// Print total opens ? iostats("Opens")
https://www.lianja.com/doc/index.php/IOSTATS()
profile do myapp // Another example profile replace expiry with start_date + 30
https://www.lianja.com/doc/index.php/PROFILE
set exclusive on set dcache to 500 set dcache on set cacheload on use patrons index events set dcache off
https://www.lianja.com/doc/index.php/SET_CACHELOAD
// Open up payroll system set exclusive on set cacheload on set icache to 3000 set dcache to 1000 use payroll index pay_date, emp_code // Cache the employee records in memory set dcache on use employees index name, emp_code set dcache off use wages index emp_code
https://www.lianja.com/doc/index.php/SET_DCACHE
open database southwind explain select * from employees where hiredate < gomonth(date(),-36)
******************************************************************************** Explaining execution plan for command: select * from employees where hiredate < gomonth(date(),-36) -------------------------------------------------------------------------------- SET EXCLUSIVE ON SET NETWORKSHARE OFF SET SMARTQUERY OFF SET STRCOMPARE ON (Case insensitive string comparisons with padding) SET DCACHE ON (Table page cache) SET DCACHEBLOCKSIZE TO 8192 (Size of table cache pages) SET DCACHESIZE TO 10 (Number of table pages to cache) SET ICACHE TO 50 (Index node cache) SET SQLCACHE ON (SQL Query cache) SET SQLCACHESIZE TO 65536 (Size of SQL Query cache extents) SET SQLBUFFERSIZE TO 1024 (Number of SQL write cache buffers) WHERE condition for table 'employees' could not be optimized Total I/O read operations was 0 Total I/O read size was 0.0000MB Total I/O write size was 0.0000MB Total SEEK operations performed was 0 Total SEEK operations failed was 0 Total locks performed 0 Total rlocks performed was 0 Total unlocks performed was 0 (0 active) Total I/O read cache hits was 11 Total I/O read cache misses was 0 Total I/O index reads was 0 Total I/O index cache hits was 0 Total I/O index cache misses was 0 9 records selected in 27ms
explain select * from employees inner join orders on employees.employeeid = orders.employeeid
******************************************************************************** Explaining execution plan for command: select * from employees inner join orders on employees.employeeid = orders.employeeid -------------------------------------------------------------------------------- Optimized JOIN to table 'orders' using index tag 'EMPLOYEEID' keytype=N keylength=8 SET EXCLUSIVE ON SET NETWORKSHARE OFF SET SMARTQUERY OFF SET STRCOMPARE ON (Case insensitive string comparisons with padding) SET DCACHE ON (Table page cache) SET DCACHEBLOCKSIZE TO 8192 (Size of table cache pages) SET DCACHESIZE TO 10 (Number of table pages to cache) SET ICACHE TO 50 (Index node cache) SET SQLCACHE ON (SQL Query cache) SET SQLCACHESIZE TO 65536 (Size of SQL Query cache extents) SET SQLBUFFERSIZE TO 1024 (Number of SQL write cache buffers) Performing join Parent table 'employees' has 12 records, table size is 128.000KB, DCACHE is ON, DCACHEBLOCKSIZE 8451, record size 313, records per page 27 Child table 'orders' has 834 records, table size is 256.000KB, DCACHE is ON, DCACHEBLOCKSIZE 8451, record size 251, records per page 33 Processing parent table 'employees' sequentially Total I/O read operations was 215 Total I/O read size was 1.7296MB Total I/O write size was 0.0000MB Total SEEK operations performed was 11 Total SEEK operations failed was 0 Total locks performed 0 Total rlocks performed was 0 Total unlocks performed was 0 (0 active) Total I/O read cache hits was 846 Total I/O read cache misses was 214 Total I/O index reads was 8 Total I/O index cache hits was 32 Total I/O index cache misses was 8 822 records selected in 75ms
// Cause all SQL SELECT statements to use EXPLAIN set explain on select * from employees where hiredate < gomonth(date(),-36) select * from employees inner join orders on employees.employeeid = orders.employeeid
EXPLAIN execution plans output as above
// Send EXPLAIN output to a text file set alternate to explain set console off set alternate on explain select * from employees inner join orders on employees.employeeid = orders.employeeid close alternate
EXPLAIN execution plans output to explain.txt
https://www.lianja.com/doc/index.php/EXPLAIN
open database southwind explain select * from employees where hiredate < gomonth(date(),-36)
******************************************************************************** Explaining execution plan for command: select * from employees where hiredate < gomonth(date(),-36) -------------------------------------------------------------------------------- SET EXCLUSIVE ON SET NETWORKSHARE OFF SET SMARTQUERY OFF SET STRCOMPARE ON (Case insensitive string comparisons with padding) SET DCACHE ON (Table page cache) SET DCACHEBLOCKSIZE TO 8192 (Size of table cache pages) SET DCACHESIZE TO 10 (Number of table pages to cache) SET ICACHE TO 50 (Index node cache) SET SQLCACHE ON (SQL Query cache) SET SQLCACHESIZE TO 65536 (Size of SQL Query cache extents) SET SQLBUFFERSIZE TO 1024 (Number of SQL write cache buffers) WHERE condition for table 'employees' could not be optimized Total I/O read operations was 0 Total I/O read size was 0.0000MB Total I/O write size was 0.0000MB Total SEEK operations performed was 0 Total SEEK operations failed was 0 Total locks performed 0 Total rlocks performed was 0 Total unlocks performed was 0 (0 active) Total I/O read cache hits was 11 Total I/O read cache misses was 0 Total I/O index reads was 0 Total I/O index cache hits was 0 Total I/O index cache misses was 0 9 records selected in 27ms
explain select * from employees inner join orders on employees.employeeid = orders.employeeid
******************************************************************************** Explaining execution plan for command: select * from employees inner join orders on employees.employeeid = orders.employeeid -------------------------------------------------------------------------------- Optimized JOIN to table 'orders' using index tag 'EMPLOYEEID' keytype=N keylength=8 SET EXCLUSIVE ON SET NETWORKSHARE OFF SET SMARTQUERY OFF SET STRCOMPARE ON (Case insensitive string comparisons with padding) SET DCACHE ON (Table page cache) SET DCACHEBLOCKSIZE TO 8192 (Size of table cache pages) SET DCACHESIZE TO 10 (Number of table pages to cache) SET ICACHE TO 50 (Index node cache) SET SQLCACHE ON (SQL Query cache) SET SQLCACHESIZE TO 65536 (Size of SQL Query cache extents) SET SQLBUFFERSIZE TO 1024 (Number of SQL write cache buffers) Performing join Parent table 'employees' has 12 records, table size is 128.000KB, DCACHE is ON, DCACHEBLOCKSIZE 8451, record size 313, records per page 27 Child table 'orders' has 834 records, table size is 256.000KB, DCACHE is ON, DCACHEBLOCKSIZE 8451, record size 251, records per page 33 Processing parent table 'employees' sequentially Total I/O read operations was 215 Total I/O read size was 1.7296MB Total I/O write size was 0.0000MB Total SEEK operations performed was 11 Total SEEK operations failed was 0 Total locks performed 0 Total rlocks performed was 0 Total unlocks performed was 0 (0 active) Total I/O read cache hits was 846 Total I/O read cache misses was 214 Total I/O index reads was 8 Total I/O index cache hits was 32 Total I/O index cache misses was 8 822 records selected in 75ms
// Cause all SQL SELECT statements to use EXPLAIN set explain on select * from employees where hiredate < gomonth(date(),-36) select * from employees inner join orders on employees.employeeid = orders.employeeid
EXPLAIN execution plans output as above
// Send EXPLAIN output to a text file set alternate to explain set console off set alternate on explain select * from employees inner join orders on employees.employeeid = orders.employeeid close alternate
EXPLAIN execution plans output to explain.txt
https://www.lianja.com/doc/index.php/SET_EXPLAIN
set fcache on
https://www.lianja.com/doc/index.php/SET_FCACHE
set iostats on do myapp list iostats
https://www.lianja.com/doc/index.php/SET_IOSTATS
set network on
https://www.lianja.com/doc/index.php/SET_NETWORK
set profile on set profile to "start", "myapp", "Start of update section" //...
https://www.lianja.com/doc/index.php/SET_PROFILE
set smartquery on set smartquery to 2
https://www.lianja.com/doc/index.php/SET_SMARTQUERY
set sqlcache on set sqlcache to 128 // ODBC/SQL Server hn = sqlconnect("Lianja_Southwind") sqlexec(hn,"lianja set sqlcache to 128") // ... sqldisconnect(hn)
https://www.lianja.com/doc/index.php/SET_SQLCACHE
SELECT icachereads FROM sysiostats
https://www.lianja.com/doc/index.php/SYSIOSTATS
clear smartquery
https://www.lianja.com/doc/index.php/CLEAR_SMARTQUERY
SELECT user_name, level FROM syslogging
https://www.lianja.com/doc/index.php/SYSLOGGING