Best Practice in SQL

原创 2012年03月28日 14:26:00

1)      Avoid searching based on concatenation

Select * from employee where empno || name = ’1234qiao’

Select * from employee where empno=1234 and name = ’qiao’

2)      It is advisable to put the table that returns the fewest rows at the end of the From list.

Select * from table1, table2

Table1 – contains 10000,               Table2 – contains 100

3)      If more than one table is used in a query, then it is advisable to use table aliases, as it would enhance the speed of parse phase of the query.

4)      Avoid using NOT or != operators, it causes full table scan.

5)      Using EXISTS instead of IN when the selective filters are in parent query.

6)      Using IN instead of EXISTS when the selective filters are in sub query.



决胜Spark大数据时代企业级最佳实践:Spark Core&Spark SQL&GraphX&Machine Learning&Best Practice

王家林:Spark、Docker、Android技术中国区布道师。 联系邮箱  电话:18610086859  QQ:1740415547  微信号:18...

vSphere Best Practice

  • 2016-02-28 03:17
  • 1.91MB
  • 下载

  • 2016-03-24 07:03
  • 3.10MB
  • 下载

AsyncHttpClient Best Practice

AsyncHttpClient是一款开源的Java异步Http和WebSocket 客户端官方原文 Asynchronous Http and WebSocket Client library f...

ASP.NET WebForm Best Practice 之PostBack关于PostBack,我曾经也写过一篇博客《深入理解 __doPostBac...
  • plean
  • plean
  • 2011-07-04 14:13
  • 266


  • 2009-08-04 21:37
  • 791KB
  • 下载

Maven私服(Best Practice - Using a Repository Manager)

Maven私服(Best Practice - Using a Repository Manager)A repository manager is a dedicated server applic...