Below I have 2 almost identical queries, only the limit is different.
Nevertheless, the query plan and execution time are totally different. The first query is +300 times slower than the second one.
...

I am currently exploring the SQL server XML column and Selective indexes for our needs. For doing so I created table called Incidents and created the Selective Index and Secondary selective Indexes ...

I am using Netezza/Pure Data for a query. I have a INNER JOIN (which became a HASH JOIN) on two columns A and B. A is a column that has good distribution and B is a column that has bad distribution. ...

This question comes as a follow up to and a result of SQL function very slow compared to query without function wrapper. I should note that I don't consider this a duplicate, since that question was ...

I'm trying to optimise a PostgreSQL 8.4 query. After greatly simplifying the original query, trying to figure out what's making it choose a bad query plan, I got to the point where running the query ...

When I execute the SQL below I can see that all the records are being buffered in TempDb prior to the insert into the DB2 table. This kills performance with large volumes.
The execution plan suggests ...

I have read Indexing Order By section of "SQL Performance Explained" book. I have some questions about it. Consider we have a compound index on (a, b, c). Is my understanding correct?
SELECT * FROM ...

I am trying to execute this following procedure in SQL Server 2005. I was able to execute this in my development server and when i tried to use this in the Live Server I am getting an Error "Internal ...

I'm writing this finding due to auto-created SQL by EntityFramework (see related question):
When returning the result of glob() (or like()) it appears that the type of these functions is bit:
SELECT ...

Suppose the data distribution does not change, For a same query, only dataset is enlarged a time, will the time taken also becomes 1 time? If the data distribution does not change, will the query plan ...

I noticed one of my SQL queries is much slower than I expected it to be, and it turns out that the query planner is coming up with a plan that seems really bad to me. My query looks like this:
select ...

For a query that has no order by clause, will a given query plan always return results in the same order? I understand that a different plan may be chosen, but if the same plan is chosen, will that ...

I'm studying about ad hoc statement performance, and it seems everything is moving around the type of statement "safe", respectively "unsafe" with a sable/unstable plan.
Simply said, how can I know ...

I'm attempting to debug a query which is slow on production, but fast on my development machine. My dev box has a snapshot of the prod database which is only a couple of days old, so the contents of ...