Wednesday 29 February 2012

EXPLAIN keyword Usage in SQL

The SQL compiler can capture information about the access plan and environment of static or dynamic SQL statements. The captured information helps you understand how individual SQL statements are executed so that you can tune the statements and your database manager configuration to improve performance.

You collect and use explain data for the following reasons:
  • To understand how the database manager accesses tables and indexes to satisfy your query
  • To evaluate your performance-tuning actions
In Front Any SQL Query just Give EXPLAIN key word . That shows the following things .That Based On how many Table using





   

Friday 17 February 2012

Setting Eclipse Memory Size

You working in eclipse means  some time that hangs.Because of not enough memory. Initially in eclipse.ini file memory is like this

-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx 512m

that depend on different Operating System.

        Among other things, this sets the heap space to 40MB initially and a maximum of 512MB, and also specifies a maximum PermGen size of 256MB.

        A max heap of 512MB might be OK for some users, but it's often necessary to bump that value up for large project sets or when some third-party plugins are installed.

      So You need  increase memory size 1024MB.It enough for users.Or you increase above 1024MB.




-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx "YOUR MEMORY SIZE HERE "m

If you increase memory then eclipse works fine.








Thursday 16 February 2012

How To String Concatenation with Null values in SQL?

Normally If You concate One String Value With NULL values means  That Returns NULL value only or some time that Query result not came.To Prevent this by use of  "ISNULL(....)"   Statement.


Example:

      SELECT  CONCAT(ID,ISNULL(NAME,' '))  FROM TABLE_NAME WHERE CONDITION

In that  ISNULL checks  the  NAME .The  Value of NAME  is  NULL means replace Empty String and  concat with ID and return result.Otherwise it returns Actual value of NAME and concat with ID and return result.

   You Can also use "COALESCE" instead of  "ISNULL" .Both Doing Same action only.

It also Work in HQL.