3. ใช้ EXISTS เร็วกว่า IN แน่นอน
ยกตัวอย่างอันนี้ผมใช้ใน Oracle นะครับ
select f1,f2,f3 from my_table where
exists (select 1 from dual where f1=1 or f1=2 or f1=3)
เร็วกว่า
select f1,f2,f3 from my_table where
f1 in (1,2,3)
ฟันธง
ยกตัวอย่างอันนี้ผมใช้ใน Oracle นะครับ
select f1,f2,f3 from my_table where
exists (select 1 from dual where f1=1 or f1=2 or f1=3)
เร็วกว่า
select f1,f2,f3 from my_table where
f1 in (1,2,3)
ฟันธง
ความคิดเห็น
แสดงความคิดเห็น