OR보다는 IN이 더 빠르다는군요
페이지 정보
작성자 서방님 댓글 0건 조회 140회 작성일 06-09-13 11:23본문
내용의 확실한 전달을 위해서 원문을 그대로 실었습니다.
참고하세요.. ^^;
Tip 1:
In sql, it's actually faster (and easier) to use an 'In' clause,
rather than lots of OR something = this OR something = that. Ex..
SELECT * FROM Cars WHERE Model = 'Ford' OR Model = 'GM' OR Model = 'Chrysler'
This is faster (and more readable):
SELECT * FROM Cars WHERE Model In ('Ford', 'GM', 'Chrysler')
Tip 2:
Although at first, they may seem slightly complex (for some people just starting to use sql),
try to use INNER JOINs as they are faster than embedded sql statements. Ex.
SELECT * FROM Cars WHERE Color In (SELECT Color FROM Color_Palette)
This is faster:
SELECT * FROM Cars INNER JOIN Color_Palette ON Cars.Color = Color_Palette.Color
자료출처 : http://www.devpia.com/Forum/BoardView.aspx?no=446&page=13&Tpage=18&forumname=sql_lec&stype=&ctType=
댓글목록
등록된 댓글이 없습니다.