Thursday, February 16, 2012

A performance question: "SELECT ID as subID FROM myTable AS myTable1"

For some reasons I need to access the same field of the same table twice in a query, and each give out a diferrent value
Like this:
"SELECT myTable.id, myTable1.id as subID FROM myTable INNER JOIN ... INNER JOIN myTable as myTable1 ..."
The question is, when I write it as myTable as myTable1 will it affect the query performance if myTable is a large table? will it create another so big copy of myTable? or I should create a view like "CREATE VIEW myTable1 AS SELECT id FROM myTable" to reduce the side of myTable1?
Thank you.

Views are actually slower than stored procedures...

No comments:

Post a Comment