Oracle10gã§ã®SQLãã¥ã¼ãã³ã°
ä»ä½³å¢ã®ããã¸ã§ã¯ãã«çªã£è¾¼ã¾ãã¦ãã¦ãå¤é¨ãã¼ããã¼ãããä½ã£ãSQLããã¥ã¼ãã³ã°ãã¦ããã®ã§ãããä»åããï¼ãããªã®ï¼ãã¨æã£ããã¨ããã£ãã®ã§ã¡ã¢ãã©ãã次ã«ããã¨ãã«ã¯ãã¾ãå¿ãã¦ããã§ããã(^^;
ç°å¢ã¯
- Oracle 10g Release2 Standard Edition
- ã³ã¹ããã¼ã¹ãªããã£ãã¤ã¶
- ANALYZE TABLE ... SAMPLE 30 PERCENT
ãªæãã§ãã
ORæ¡ä»¶ãREGEXP_LIKEé¢æ°ã«å¤æ´ãã
å½ç¶indexã®ç¶æ ãå¼ãªã©ã¢ãã«ãã£ã¦ãå¤ããã¾ãããä»åãè¤æ°ã«ã©ã ã®å¤ã«å¯¾ããè¤æ°ã®ORæ¡ä»¶ããREGEXP_LIKEé¢æ°ã«å¤æ´ããã¨ããªãã³ã¹ããå¤ããã¾ããã以ä¸ã§ãvalAãvalBãvalCã¯åãSQLå ã®å¥ã¹ãã¢ãé¢æ°ã§ç®åºãããå¤ã§1ã5ã§ãã
â 使ç¨å WHERE (valA != '1' OR valB != '3' OR valC != '5') AND ... â 使ç¨å¾ WHERE REGEXP_LIKE(valA || valB || valC, '[^135]') AND ...
ã¡ãªã¿ã«ãvalAãvalBãvalCã¯ãä»å¾1ã5以å¤ã®å¤ãåãå¾ãã®ã§ã[^135]ã¨ãã¦ã¾ãã確å®ãã¦ããã®ã§ããã°ã[24]ã§å åã§ãã
INDEXãå¹ããªãã«ã©ã ã§ã®ã½ã¼ãã¯æ©ãã«è¡ã
â 使ç¨å SELECT * FROM ( SELECT some_function(...) AS a, ... FROM ... WHERE ... ) WHERE ... ORDER BY a, ...
ã®ãããªSQLã§ã¯INDEXã使ããªããããã½ã¼ãå¥ãããã«ããã¯ã«ãªãå ´åãããã¾ãããã®å ´åãAUTOTRACEãªã©ã®SQLçµ±è¨ã§recursive callsãé常ã«å¤§ããªå¤ã«ãªã£ã¦ããããºã§ããä»åã¯ãã¹ãã4ã¬ãã«ãããã®SQLã§ããããããã£ãSQLã§ä»¥ä¸ã®ããã«ã½ã¼ãå¥ãé«ã¬ãã«å´ã«ç§»åããã
â 使ç¨å¾ SELECT * FROM ( SELECT some_function(...) AS a, ... FROM ... WHERE ... ORDER BY a, ... /* ããã«ç§»å */ ) WHERE ...
ã¨ãrecursive callsãå°ãããªããçµæçã«ããã©ã¼ãã³ã¹ãåä¸ãã¾ããã
ããã¹ã¦ããããã°ãã¾ããããã¨ã¯éããªãã®ãSQLãã¥ã¼ãã³ã°ã§ãããé
ãSQLãå¾ã
ã«æ©ããªãã®ã¯é¢ç½ãã§ããã大å¤ã§ããã©ããã
ããããã°ãOracle9iã使ã£ã¦ããæã«ãæã£ããã§ããã
- ã«ã¼ã«ãã¼ã¹ã®å ´åã¯ãæ©ãSQLã®æ¸ãæ¹ããããå¿ è¦ããã
- ã³ã¹ããã¼ã¹ã®å ´åãç´ ç´ãªSQLãã®æ¹ãç·ãã¦æ©ãSQLã«ãªã
ãããªæ°ããã¾ãããããã絶対ãããããã¾ãããããã