Querying against Views vs Tables

5 pts.
Tags:
MySQL query
SQL
I have a view that combine several tables, so that the view presents more information that each table taken individually. I want to write an "INSERT INTO ... SELECT ... FROM xxx" query. Should I use the View in that "FROM xxx" or should I expand what the view shows? What's better in terms of optimization and/or business practice? (I run on MySQL if it makes any difference)

Software/Hardware used:
MySQL 5.1.52

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    I would say that using the view or the underlying query would be the same in terms of performance, but if the business requirement is that the INSERT must always insert the same data than the one returned by the view, then you should use the view, so that if for any reason the view definition changes in the future, you don't have to remember to modify this insert as well. On the contrary, if the INSERT is not directly related to the view, but the data you need to insert is coincidentally the same as the view (by now), then I would use the query.
    69,835 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following