4

I have 2 tables :

Table A 

ID int,
Name varchar,
Address varchar


Table B 

ID int,
Name varchar,
Address varchar,
Col1...
...
Col100

I want to update A.Name with B.Name based on both table's ID.

UPDATE A 
    SET A.NAME = B.NAME 
    FROM A JOIN (SELECT ID, Name from B) AS B ON A.ID = B.ID 

UPDATE A 
    SET A.NAME = B.NAME 
    FROM A JOIN B AS B ON A.ID = B.ID 

Because I don't have the permission to set the option for viewing execution plan, I ran 2 queries above many times and see the processed time to guess which one has better performance.

With about 700k records, both queries's result slightly differ.

So my question is, if executed, will both queries have the same execution plan? (I mean will the database engine process them by the same way? )

P/S : I'm using SybaseIQ 16.0.0.429

Update : I'm getting the permission for viewing the execution plan. In case both plan are identical, does is mean both queries will be processed the same (100% sure) ?

EagerToLearn
  • 675
  • 7
  • 24

1 Answers1

6

I got the execution plan. Both queries have identical plan.

And Sybase automatically "reworded" the first query, the actual executed query is exactly the same with the second query :

UPDATE A 
    SET A.NAME = B.NAME 
    FROM A,B WHERE A.ID = B.ID 

Conclusion : both queries are identical.

EagerToLearn
  • 675
  • 7
  • 24