I got a task to run the following two SQLs in 20 site databases, the table is very big, about 100GB size in every database. So it not a easy task.
SELECT /*+ FULL(T) PARALLEL(T,4) */ COUNT(*) FROM BIGTABLE T
WHERE COL1 < 1000000000 AND ......
/
SELECT /*+ FULL(T) PARALLEL(T,4) */ COUNT(*) FROM BIGTABLE T
WHERE COL1 > 1000000000 AND ......
/
To save time, I merge them into one SQL before run. So I can get the two results within one SQL, half of the time were saved. DBA cannot just complain bad SQL provided by development team, you have the responsibility to rewrite it.
SELECT /*+ FULL(T) PARALLEL(T,4) */
SIGN(COL1 - 1000000000), COUNT(*) FROM BIGTABLE T
WHERE ...... GROUP BY SIGN(COL1 - 1000000000)
/
If you can make these kind of change before run it, you will be a good DBA.
