Showing posts from June, 2012


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

Compiz script cube rotation 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 String[] tokens = s . split ( "(?<=\\G...)" ) The regex  (?<=\G...)  matches an empty string that has the  last match  ( \G ) followed by  three characters  ( ... )  before  it ( (?<= ) )