4.C.2.1. Quick COUNT
Anyone who uses SQL knows that to get the number of rows in the table, you must execute the command:
SELECT COUNT (*) FROM "TAB"
Not everyone knows that to command it was very quick, you have to mobilize the database would not have reached to a data table, but only to the index of table, such as primary key. To do this you must use a "hint". Execute the following command, and you'll see what the difference of speed:
SELECT /*+ INDEX_FFS(TAB) */ COUNT(0) FROM TAB
Addition to not write such a long command, you can use a macro Orbada. In the plug-ins settings, locate "SQL Macros". There, create a macro whose definition is as follows:
Macro Name: COUNT <table> [WHERE ...]
Regular expression: ^*COUNT\s+([a-zA-Z_0-9$#]+|".+")?(\s+WHERE\s+(.*))?
Transformated SQL macro: select /*+ INDEX_FFS( $1 )*/ count( 0 ) from $1$2
On tab SQL queries, do:
COUNT "TAB"
Thats all!
4.C.2.2. Primary key trigger
Call sequences for primary key according to the template TABLE_SEQ. Then you can quickly create a trigger, which gives the value of the primary key column by selecting an option from the trigger tab "Primary key trigger"
4.C.2.3. Database sessions
If the scheme/user to which you have connected, has the rights to the system view V$SESSION
, V$PROCESS
, V$SESS_IO
, V$INSTANCE
, then you can browse the sessions of the database with a special view Orbada.