Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 2 of 2 total |
ORDER BY Clause Using DESC Index |
Thu, Jul 22 2010 5:18 PM | Permanent Link |
Richard Harding Wise Nutrition Coaching | Tim
Using EDB 2.03b15. I have a table which looks something like this. CREATE TABLE "ClientEpisode" ( "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 281, INCREMENT BY 1) NOT NULL, "ClientID" INTEGER NOT NULL, "EpisodeDate" TIMESTAMP NOT NULL, <more stuff> CONSTRAINT "cePrimaryKey" PRIMARY KEY ("ID") ) CREATE INDEX "ceClientDateIND" ON "ClientEpisode" ("ClientID", "EpisodeDate" DESC) CREATE INDEX "ceClientIND" ON "ClientEpisode" ("ClientID", "EpisodeDate") The queries below both produce the result set in DESCENDING EpisodeDate order. SELECT * FROM ClientEpisode ORDER BY ClientID, EpisodeDate ASC SELECT * FROM ClientEpisode ORDER BY ClientID, EpisodeDate DESC The execution plan for both queries stated "The result set was ordered using the index ceClientDateIND" Richard Harding |
Fri, Jul 23 2010 10:07 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Richard,
<< The execution plan for both queries stated "The result set was ordered using the index ceClientDateIND" >> Yep, it's checking for DESC against ASC indexes, but not ASC against DESC indexes. It's now fixed for B18, which I'm doing over the weekend. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Tuesday, September 17, 2024 at 04:19 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |