Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1040137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:11:12+00:00 2026-05-16T15:11:12+00:00

I’m working on building a MySQL database and I’m thinking that rather than encode

  • 0

I’m working on building a MySQL database and I’m thinking that rather than encode a bunch of complex join queries in the front end I’ll create a view for any queries I need and then have all the front end code do simple SELECT whatever FROM some_view WHERE something=5; queries.

It seems like a great idea as it abstracts away the underlying schema so the front end doesn’t need to know about it and given that MySQL can merge views into queries I’d think this would be no less efficient than the more direct solution.

Now for the question: Is this a stupid idea for some reason I’m not spotting?


Note: This would only go two layers deep, e.i. views would only reference tables, never views.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:11:13+00:00Added an answer on May 16, 2026 at 3:11 pm

    Views can simplify the amount of text you need to create a query, but layering views on top of one another is a bad practice.

    That encapsulation also risks poor performing queries, because the views need to be executed before being able to join to one another–all that logic inside might not apply to what you need for the ultimate result, so being lazy can easily mean a query that doesn’t perform as well as it should.

    Because the views are queries that are only run when called, you won’t know about missing references until runtime.

    Be aware that when using SELECT * in a view, the database captures the column list when the CREATE VIEW statement was run – if the columns change, you need to refresh the view to pick up the changes.

    There’s also no performance difference between a view and running the query the view is based on. With the exception of materialized views (which MySQL doesn’t support), views are just a prepared statement. If simple enough, WHERE predicates can be pushed from the FROM view WHERE .... into the inner query, but it means no use of functions and isn’t reliable.

    Conclusion

    OK, but be careful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build
I know there's a lot of other questions out there that deal with this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.