|
Log in | ||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
There were discussions on this over a year ago, I recall. But I don't
recall a consensus emerging. What is the most efficient way of running a query to produce an empty resultset? Select * from MyTable Where ....??? -d |
|
#2
|
|||
|
|||
|
True = false?
1=0? |
|
#3
|
|||
|
|||
|
"Chris" <nospam@nospam.com> wrote in message news:46ee69de$1@nexus-vkpb9bih5.Nexus.local... > True = false? > 1=0? Yep, I wonder if there is something even more efficient than that. On a table with about 30 columns and 1000 records this takes 328 msecs. It'll do, but... -d |
|
#4
|
|||
|
|||
|
Dennis Landi wrote:
> "Chris" <nospam@nospam.com> wrote in message > news:46ee69de$1@nexus-vkpb9bih5.Nexus.local... >> True = false? 1=0? > > Yep, I wonder if there is something even more efficient than that. > > On a table with about 30 columns and 1000 records this takes 328 > msecs. > > It'll do, but... > > -d Turn off request live since it causes it to evaluate the condition for each record. Using TOP 0 will also prevent the query from being live. #L- SELECT * FROM SOMETABLE WHERE 0=1; or SELECT TOP 0 * FROM SOMETABLE; -- Brian Evans [NDX] Ottawa, ON, CANADA GMT-5 |
|
#5
|
|||
|
|||
|
Brian Evans [NDX] wrote:
> Dennis Landi wrote: >> "Chris" <nospam@nospam.com> wrote in message >> news:46ee69de$1@nexus-vkpb9bih5.Nexus.local... >>> True = false? 1=0? >> >> Yep, I wonder if there is something even more efficient than that. >> >> On a table with about 30 columns and 1000 records this takes 328 >> msecs. >> >> It'll do, but... >> >> -d > > Turn off request live since it causes it to evaluate the condition > for each record. Using TOP 0 will also prevent the query from being > live. > > #L- SELECT * FROM SOMETABLE WHERE 0=1; > > or > > SELECT TOP 0 * FROM SOMETABLE; > Opps, #L is for log. The request live query is an option not a statement switch. -- Brian Evans [NDX] Ottawa, ON, CANADA GMT-5 |
|
#6
|
|||
|
|||
|
"Brian Evans [NDX]" <bevanson@rogers.com> wrote in message news:46ee7ca8@nexus-vkpb9bih5.Nexus.local... >> Turn off request live since it causes it to evaluate the condition for >> each record. Using TOP 0 will also prevent the query from being >> live. >> >> #L- SELECT * FROM SOMETABLE WHERE 0=1; >> >> or >> >> SELECT TOP 0 * FROM SOMETABLE; >> > > Opps, #L is for log. The request live query is an option > not a statement switch. Thanks Brian. |
|
#7
|
|||
|
|||
|
"Dennis Landi" <nada@nada.com> wrote in message news:46ee6b09$1@nexus-vkpb9bih5.Nexus.local... > > "Chris" <nospam@nospam.com> wrote in message > news:46ee69de$1@nexus-vkpb9bih5.Nexus.local... >> True = false? >> 1=0? > > Yep, I wonder if there is something even more efficient than that. > > On a table with about 30 columns and 1000 records this takes 328 msecs. > > It'll do, but... > > -d > Seems odd, I've just tested against my address server table with 1.7m rows, 30 (ish) columns over my wireless network and it completes is 78ms. I guess the 'request live' really does slow it down....yep, just tried and it takes forever. |
|
#8
|
|||
|
|||
|
> Seems odd, I've just tested against my address server table with 1.7m rows,
> 30 (ish) columns over my wireless network and it completes is 78ms. I guess > the 'request live' really does slow it down....yep, just tried and it takes > forever. Request live is essentially working like a server side sql filter. -- Hannes Danzl [NexusDB Developer] Newsgroup archive at http://www.tamaracka.com/search.htm |
|
#9
|
|||
|
|||
|
Chris wrote:
> True = false? > 1=0? Would WHERE True=False actually be faster than WHERE False ? I use the latter all the time. I even created a routine to change any SQL statement SELECT .... WHERE ..... into SELECT .... WHERE FALSE AND .... (I needed this just to get the output column names & types, and NO DATA) -- Thanks, Hans Hasenack (Netherlands) |
|
#10
|
|||
|
|||
|
"Dennis Landi" <nada@nada.com> wrote in message news:46ee645c$1@nexus-vkpb9bih5.Nexus.local... > There were discussions on this over a year ago, I recall. But I don't > recall a consensus emerging. > > What is the most efficient way of running a query to produce an empty > resultset? > > Select * from MyTable > Where > ...??? > Anyone found faster than: SELECT * FROM "MyTable" where 1 = -1 ??? -d |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Column default option EMPTY | Ole Willy Tuv | nexusdb.public.support.sql | 72 | 14th December 2006 09:25 PM |
| Returning an empty dataset | Hans Hasenack | nexusdb.public.support.sql | 7 | 12th September 2006 05:26 PM |
| On the "empty identifier" front ... | Martijn Tonies | nexusdb.public.support.sql | 3 | 7th September 2006 07:54 PM |
| Deliberately return an EMPTY ResultSet from a Query | Dennis Landi | nexusdb.public.support.sql | 6 | 31st January 2006 07:19 AM |
| Result Fields are empty | Bernhard Roos | nexusdb.public.support.sql | 6 | 3rd December 2005 04:31 AM |