title: What's the best practice: Using queryBuilders or creating table view?
body: <p>I use Phalcon which has it's own <strong>query builder</strong>: <a href="https://olddocs.phalconphp.com/en/3.0.0/api/Phalcon_Mvc_Model_Query_Builder.html" rel="nofollow noreferrer">https://olddocs.phalconphp.com/en/3.0.0/api/Phalcon_Mvc_Model_Query_Builder.html</a></p>
  
  <p>and PostgreSQL where I create table <strong>views</strong> that joins complicated queries to one table which next is represented in PHP as a <strong>TableModelClass</strong>. </p>
  
  <p><strong>My question is:</strong> what's the best practice, creating views and then reperesent it in <strong>TableModelClass</strong> or using query builder for joining tables?</p>
  
  <p>What are the pros and cons of using both methods? </p>
  
  <p>For example when I use view I can also add aditional <strong>WHERE</strong> on it and generate more specified results. So for me that's better way, but I'm not sure if its the best.</p>
  
  <p>I read on the internet (<a href="https://dba.stackexchange.com/questions/151169/are-views-harmful-for-performance-in-postgresql">https://dba.stackexchange.com/questions/151169/are-views-harmful-for-performance-in-postgresql</a>) that <strong>views</strong> are not slower than normal query and that means that query sended by <strong>query builder</strong> has this same speed in geting results?</p>