2013年2月26日 星期二

[SQL]反向查詢吃不到INDEX

剛剛在看文件的時候看到
select 的條件若有 <> 時會吃不到Index

另外也儘量不用 not in
可以用not exists or in ( select ... from table1 minus select ... from table2)

以上可以提升效能

http://stackoverflow.com/questions/3545323/why-the-select-from-table-where-id-not-in-list-of-int-ids-query-is-slow-in

沒有留言:

張貼留言