Posts

Showing posts from June, 2012

Queries

Why does count, min, max explain plan show a sort operation? SELECT count(1) FROM foo; SELECT min(x) FROM foo; Count/min/max/etc. will always show a sort operation in the explain plan because they are aggregate functions with an implicit group by even if they return only one row. They share the common code path even though it is effectively a no-op. Faster count avoiding full index/table scan with sampling: 1% sample SELECT COUNT(1) * 100 FROM  SAMPLE (1); Find ALL FKs to a table: SELECT owner,   constraint_name,   constraint_type,   table_name,   r_owner,   r_constraint_name FROM all_constraints WHERE constraint_type  ='R' AND r_constraint_name IN   (SELECT constraint_name   FROM all_constraints   WHERE constraint_type IN ('P','U')   AND table_name         ='DATA_AUDIT'   );

Power down display

http://ubuntuforums.org/showthread.php?t=608212 http://www.x.org/releases/X11R7.6/doc/libXext/dpmslib.html

Compiz script cube rotation

http://sfyang-en.blogspot.com/2008/02/rotate-cube-in-compiz-with-wmctrl.html Initiate rotate from command line, Exc exits rotation: dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/rotate/allscreens/initiate_button org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print $4 }'`

Split string every nth char

http://stackoverflow.com/questions/2297347/splitting-a-string-at-every-n-th-character String[] tokens = s . split ( "(?<=\\G...)" ) The regex  (?<=\G...)  matches an empty string that has the  last match  ( \G ) followed by  three characters  ( ... )  before  it ( (?<= ) )