Re: can my query be optmised
From: Joe Celko (joe.celko_at_northface.edu)
Date: 04/03/04
- Next message: paul reed: "Degree of Parallelism Probems with a Query"
- Previous message: John Kane: "Re: Store and search MS word documents"
- In reply to: chris: "Re: can my query be optmised"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 02 Apr 2004 17:51:04 -0800
Here is one way to get rid of extrema in a numeric column. In many SQL
products, this is faster than you would think because the stats include
the min and max for columns.
CREATE TABLE Foobar(i INTEGER NOT NULL PRIMARY KEY);
SELECT F1.i
FROM Foobar AS F1, Foobar AS F2
GROUP BY F1.i
HAVING F1.i BETWEEN MIN(F2.i)+1 AND MAX(F2.i)-1;
Is that what you were trying to ask?
--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- Next message: paul reed: "Degree of Parallelism Probems with a Query"
- Previous message: John Kane: "Re: Store and search MS word documents"
- In reply to: chris: "Re: can my query be optmised"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|