Shrink LDF file in SQL SERVER 2008

Today i had a problem.  when i checked my database LDF file (log) file it’s some where around 25GB. I was trying to shrink the file it’s not possible. Could not able to shrink it from management studio. Found an workaround for that, Here the command for it.

First make the database to SIMPLE Recovery mode and do it.

— Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE [databasename]
— Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE ([log file name], 1);
— Reset the database
ALTER DATABASE [databasename]

Let me know if any questions


Steps to check website and Sql performance

Hi all,
It’s been very long time since i updated my blog.  i am really sorry for that. Well coming to the topic. I was working for one of our entrprise customer. We have web analytics data close to 90GB.  we are building another application to displaying the data, so i need to migrate the data to new database.

Intially when we started our migration it takes almost 6 days for one month data. I was wondering what to da. Then i followed the below mention steps and it come down to 3 Hours for one month.

1 check for each query execution time and also the subtree cost.  to get subtree cost include execution steps from the top bar in management studio. When sub tree cost is more sql server uses full 100% cpu time and memory.
2 created the index for each table.  while creating index make sure you create index for all where condition combination.
3 use temp table instead of union all query. Because i combine almost 60 table in single query. So instead of union all i used temp table to get the data
4 remove unnessary column in the select statement

Once you follow this points. It  will increase the website and sql performance

If any questions just mail me or add a comment


Google Analytics Sub Domain Tracking

Today I had an issue For one of our customer. They had implemented the Google analytics tracking code in their website and they have so many sub domain which they want to track in main domain GA profile Id. They had implemented the Ga code properly and also used _gaq.push([‘_setDomainName’, ”]);, but the problem is the sub domain is still capture as new visit.

when I check the problem it simple they forget to change the subdomains option in the GA profile settings page. it need to be like this

Ga Profile Settings

After I changed this also it was not working. because they had added “.”(dot) before the domain. For example if you want to capture the sub domain for we need to set it like this

_gaq.push([‘_setDomainName’, ‘‘]);


_gaq.push([‘_setDomainName’, ‘‘]);

I used GA debugger chrome extension to debug this. it’s really nice tool.You can download it from here


Back again

Today my friend karthi told me how my blog was useful to him and his team on the project. I was really happy. I stopped updating my blog regularly because of poor response of visitor, today when he said that I was really happy and plan to update my blog on regular basis because I sometime it will help others.

Thanks karthi for positive response and I am starting to write again


Google Analytics Premium

Today Google had released the google analytics premium account with the price band of $150,000 per year, i was really shocked on the price band, no idea how many enterprise customer will go for it. In general google analytics premium account we have some nice stuff like

  • Run sql query aganist your data
  • Client will owns the data
  • 24/7 support
  • 50 custom variables

Here is the GA account comparison

google account comparison chart

Because of the data Data ownership may be most of the enterprise company can look to move to GA permium account

Competition is healthy for any industry to grow and progress, but Google appears to be doing this all by itself in the field of web analytics.

will write a another post tomorrow on drawback in free GA account


Facebook f8 features

First my impression on the features they had released is WOW. Actually couple was week back I was thinking “what I was doing last year same day”. Try to find that in facebook I try scroll my wall to find but could not find it because of the amount of status msg I had, now this timeline feature solve this out. What a feature it is. I got a developer preview for testing and had a look at it it’s cool to use. Will post my preview image later tomorrow.Video upload and music , nice one to have on facebook . Next is new open graph it is awesome we can have so many things now. Will write an another post on this by this week end and I love the insights for the app, every Analytics guy will love it. They can do a separate analysis for apps alone

Will write an another post in details by tomorrow

Facebook rocks


Solving Facebook tshirt spam

Today when I was looking into my facebook wall I found most of my friends was posting the free facebook tshirt. When I ask them they told it was spam. When I try to debug further on the spam i found the problem. They did it in smart way. actually they ask for your name and facebook upload email Id, facebook gives you a unique email Id to upload the status via email address to your facebook account these guys use that upload email Id and update your status with that spam message.

To solve this go to and you can see a email Id saying upload via email . Look for find more below the upload email id. Click that and it will open a popup, in that look for refresh the upload email id and click that your unique email Id will change.


Let me know if you have any issue. If you like the post just like me in facebook


Install Cassandra 0.8.5 in windows 7

Today i was exploring Nosql option and found Cassandra 0.8.5. you can download the latest version from here. After Download Follow the Below steps

Step 1: Download Java JDK also from here
Step 2 : Install the JDK
Step 3 : Unzip the Cassandra file to some location in your local drive (D:dev)
step 4 : Go to “D:devapache-cassandra-0.8.5conf” . Open the file “cassandra.yaml” in a notepad and change the following :
Change /var/lib/cassandra/data to D:devapache-cassandra-0.8.5data
Change /var/lib/cassandra/commitlog to D:devapache-cassandra-0.8.5commitlog
Change /var/lib/cassandra/saved_caches to D:devapache-cassandra-0.8.5saved_caches

Save the file after that

Step 5: Now for everything to work correctly, you need to update the JAVA_HOME and CASSANDRA_HOME system variables. To this, we need to follow this:

Click the Start Menu
Right click Computer
Click Properties (this opens the Control Panel in the System and Security > System view)
Click Advanced system settings on the left side (this opens the System Properties dialog in the Advanced tab)
Click the Environment Variables button (this opens Environment Variables dialog)
Under the System variablesgroup:
Click New… (This opens the New System Variable dialog)
Input JAVA_HOME for the Variable name text box
Input the path to your java installation for the Variable value text box (I entered C:Program FilesJavajdk1.7.0)
Click OK
Under the System variablesgroup:
Click New… (This opens the New System Variable dialog)
Input CASSANDRA_HOME for the Variable name text box
Input the path to your Cassandra extraction for the Variable value text box (I entered D:devapache-cassandra-0.8.5)
Click OK
Click OK
Click OK
Close the Control Panel

Now you should be able to start up and run Cassandra. for that go to “D:devapache-cassandra-0.8.5bin” and double click on cassandra.bat .

If any clarification, just post a comment