MC Press Online Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Most efficient query? (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Most efficient query?
#121806
dmonti (User)
Fresh Boarder
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
Most efficient query? 8 Months ago Karma: 0  
Hi,
I am trying to find out if records exist in a file. I am looking for the query with the best performance. Which of the below queries will yield the best performance?

SELECT COUNT(*) FROM MYLIB.MYFILE WHERE FIELD2 = 'TEST'

SELECT FIELD1 FROM MYLIB.MYFILE WHERE FIELD2 = 'TEST' FETCH FIRST 1 ROWS ONLY

SELECT * FROM SYSIBM.SYSDUMMY1 WHERE EXISTS(SELECT FIELD1 FROM MYLIB.MYFILE WHERE FIELD2 = 'TEST' )


Thanks
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop
   MC-STORE.COM