Microsoft KB Archive/71297: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - "<" to "<")
Line 12: Line 12:


<pre>  SELECT max(custno) FROM cust
<pre>  SELECT max(custno) FROM cust
   WHERE custno &lt; 15000</pre>
   WHERE custno < 15000</pre>
STATUS Microsoft has confirmed this to be a problem in SQL Server version 1.10. We are researching this problem and will post new information here as it becomes available.
STATUS Microsoft has confirmed this to be a problem in SQL Server version 1.10. We are researching this problem and will post new information here as it becomes available.

Revision as of 09:35, 21 July 2020

PRSQL9103055: Queries Using the MAX() Function May Run Slowly ID Number: Q71297

1.10 OS/2 buglist1.10

Summary:

PROBLEM ID: PRSQL9103055

SYMPTOMS When a query is run that selects the maximum value from a column using the MAX() function, the query may run considerably slower than similar queries that do not use the MAX() function. The same query executed using the MIN() function may run much faster. Although the query optimizer may take advantage of indexes on the table, if they exist, the MAX() function will usually still execute slower than the MIN() function.

CAUSE This problem occurs on larger tables under certain circumstances when using the MAX() function with a WHERE clause. The following is an example of a query where this problem is evident:

  SELECT max(custno) FROM cust
  WHERE custno < 15000

STATUS Microsoft has confirmed this to be a problem in SQL Server version 1.10. We are researching this problem and will post new information here as it becomes available.