GATHER AUTO vs GATHER STALE in Oracle 11.2

When using DBMS_STATS to gather statistics, we need a method to choose which objects to gather statistics for. This is done by the parameter “OPTIONS”. The possible values for this parameter are

  • GATHER
  • GATHER AUTO
  • GATHER STALE
  • GATHER EMPTY
  • LIST AUTO
  • LIST EMPTY
  • LIST STALE

Of the above, GATHER AUTO & GATHER STALE confuse many – let’s see what’s the main difference between the two.

GATHER STALE: Oracle gathers statistics on stale objects as determined by looking at the *_tab_modifications views. The estimate percent & degree have to be provided by the user.

GATHER AUTO : Oracle decides which objects to gather fresh statistics for and also decides how to get them. Oracle determines the estimate percent to be used. The parallelism used is based on the init.ora setting. This also used *_TAB_MODIFICATIONS to decide on the eligible candidates.

FootNote:

In 12c, Oracle has done away with most of these and provides only GATHER and GATHER AUTO

Reference:

https://docs.oracle.com/database/121/ARPLS/toc.htm

http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_stats.htm#CIHBIEII

Check if HyperThreading is Enabled on Your Windows Server

It turns out that our┬ádatacentre guys had HyperThreading not turned on in our Oracle Database Server. We’re talking about ~30% improvement in performance with it turned on. Here’s a quick way to check if HyperThreading is enabled in Windows.

It uses the fact that when hyperthreading is enabled, the number of logical processors will be higher than number of cores.

Copy the below code and save it as ht_check.vbs

To run, open a command prompt, cd to the location you have the script saved (or use full path) and call
cscript ht_check.vbs


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set Plist = objWMIService.ExecQuery _
("Select * from Win32_Processor")
For Each prox in Plist
IF prox.NumberOfLogicalProcessors > prox.NumberOfCores THEN
Wscript.Echo "HYPERTHREADING ENABLED!"
Wscript.Echo "Num of Logical Procs:" + CStr(prox.NumberOfLogicalProcessors)
Wscript.Echo "Num of Cores:" + CStr(prox.NumberOfCores)
ELSE
Wscript.Echo "HYPERTHREADING NOT ENABLED!"
Wscript.Echo "Num of Logical Procs:" + CStr(prox.NumberOfLogicalProcessors)
Wscript.Echo "Num of Cores:" + CStr(prox.NumberOfCores)
END IF
Next