Enabling slow query log on Amazon RDS

On February 16, 2014, in AWS, by Anuj Gakhar

The slow query log can be used to find queries that take a long time to execute and are therefore candidates for optimization. If you want to enable slow query log on your Amazon MySQL RDS instance, you need to be aware of 2 things :- To be able to enable and disable slow query log […]

Tagged with:  

Railo, MySQL and Column Aliases

On January 11, 2012, in SQL, Railo, by Anuj Gakhar

Today, I encountered an error with one of my Railo powered websites (with MySQL as database) – it started throwing an error wherever column aliases were being used in the queries. On a cfdump, the column aliases were just not there in the resultset. The original column name was, though. Running the same query in […]

Tagged with:  

Executing Stored Procedures via ANT

On December 7, 2010, in SQL, ANT, by Anuj Gakhar

We are using ANT heavily in our current Project to automate builds for different environments. One of the requirements was to execute a Stored procedure from one of the ANT tasks. That sounds straightforward. Use the ANT Sql task and that should do it. But apprently, it turns out that using “EXEC” commands within a […]

Tagged with:  

Implementing Star Schema Design

On September 12, 2010, in Web Development, SQL, by Anuj Gakhar

I am working on a project that has a requirement to report some statistics historically. e.g. how many views a product had this week, this month, this year etc. how many comments were made on a product in the last quarter….and so on… although doing something like this does not sound overly complex when you […]

Tagged with:  

Conditional Logic in T-SQL

On March 21, 2010, in SQL, by Anuj Gakhar

I am sure this is a pretty common scenario in every developer’s coding journey. So I thought I would write up a little post mainly to remind me different ways of doing this as I always end up searching for it whenever I need this. Lets say you have a stored procedure that takes input […]

Tagged with:  

Getting Table Row Counts in Sql 2005

On September 6, 2009, in SQL, by Anuj Gakhar

I came across a nice tip while reading this article. If you want to get the number of rows in a table , you would normally do a select count(*) from tbl query, which does a table scan and can be a little time consuming query if the table has millions of rows. This little […]

Tagged with:  

Free eBook : Mastering SQL Server 2005 Profiler

On January 23, 2009, in SQL, Books, by Anuj Gakhar

Red-Gate software are giving away a free eBook “Mastering SQL Server 2005 Profiler”. I have just downloaded it and some of the topics could be quite useful as a developer. Especially the ones under “How Profiler can help Developers”. I just thought I would blog about it so anyone else interested can download as well.

Tagged with:  

SQL Server 2005 Common Table Expressions

On June 24, 2008, in SQL, by Anuj Gakhar

I was recently stuck with a problem where I had to loop over a self referencing table (unlimited parent child relationships from the same table) and generate a tree structure upto n levels and because my table didnt have the levels defined in it, the tree leveles were to be defined at run time. What […]

Tagged with:  

Querying the INFORMATION_SCHEMA

On March 3, 2008, in SQL, by Anuj Gakhar

I have always used INFORMATION_SCHEMA to some extent in some way or the other. Its quite handy to get information about database objects. This morning, I saw a nice article about this on SqlServerCentral. The author’s name is Mike and he does a pretty good job in explaining the concepts. There is also a stored […]

Tagged with:  

SQL Version of YesNoFormat

On February 15, 2008, in SQL, by Anuj Gakhar

I was reading some SQL tips and found this small but quite handy tip. If you have a boolean column in your database which holds values like 0 and 1 , you can modify your Select queries to represent that data as a Yes or No by doing this. [sql]SELECT SUBSTRING(‘YesNo’, 4 – 3 * […]

Tagged with:  
© 2011 Anuj Gakhar