database - Performance of VIEW vs. SQL statement -


I have a query that something like:

  Lt; Field list & gt; From & lt; Table list & gt; Where & lt; Terms of Joining & gt; And & lt; Condition list & gt; And in PrimaryKey (choose from primary & lt; table list & gt; where & lt; join list & gt; and & lt; condition list & gt;) and not in PrimaryKey (& lt; table list & gt; where & Lt; joining list & gt; and & lt; condition list & gt;)  

The sub-selected questions have many sub-selected queries that I'm not showing , Not to disorder the statement.

My team's developers believe that one view would be better, I disagree that the SQL statement uses the variables passed by the program (based on the user's login ID).

Is there any hard and fast rules when a scene should be used. ? What are the performance gain issues in running regular tables vs. SQL statement against the scenes? (Note that all are included / where conditions are against indexed columns, so there should be no problem.)

Edit for clarification ...

Here is the query. working with:

  select obj_id the object where you choose different (Sec_id from ((security obj_id) where sec_type_id = 494 and ((sec_usergroup_id = 3278 and sec_usergroup_type_id = 230 ) or (from) Ug_gi_id user_group in sec_usergroup_id where ug_ui_id = 3278) and select where obj_ot_id of sec_obj_id (obj_id object (obj_ot_id obj_for Select the left left external m two ot_id = of_ot_id on obj_type where ot_app_id = 87 and sec_obj_id the (security of_id to) where sec_type_id = 493 and ((Sec_usergroup_id = 3278 and sec_usergroup_type_id = 230) or (Select ug_gi_id of sec_usergroup_id (user_group Where ug_ui_id = 3278) and sec_usergroup_type_id = 231)) and of_usage_type_id = 131)))) or select (obma_ot_id (ob___left_id_id_id) in the left outer ot_app_id = of_ot_id at o_t_id_id_id_id_id where ot_app_id = 87 and of_id (sec_obj_id select where sec_type_id = 493 and ((sec_usergroup_id = 3278 and sec_usergroup_type_id = 230)) or (select ug_gi_id of sec_usergroup_id (user_group where ug_ui_id = 3278) au sec_usergroup_type_id = 231))) and O_jej_taip_aidi = 131) and select sec_obj_id not (security obj_id where sec_type_id = 494))  

depending on the database vendor, normally defines SQL as a query execution sequence against a scene in which sorted clause with clause forecast and order Akspekshn that you see , A composite full SQL to execute To come up with Eri. It is executed as it was sent to the processor's query itself, so there should be no difference.

Views are an organizational tool, not performance enhancement tool.

To

When a SQL statement references a non-undefined view, parser and query optimizer analyze the source of SQL statement and view, and then Solve one execution plan. There is no separate plan for a plan and view for SQL Statement.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -