home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases.sybase
- Path: sparky!uunet!tekbspa!tssgate!esh
- From: esh@prague.tss.com (Edward S. Hirgelt)
- Subject: Re: possible FAQ Question...
- In-Reply-To: ecr2@ellis.uchicago.edu's message of Fri, 8 Jan 1993 15:53:56 GMT
- Message-ID: <ESH.93Jan8104313@prague.tss.com>
- Sender: news@tss.com (USENET Network News)
- Organization: Teknekron Software Systems, Inc.
- References: <1993Jan8.155356.19950@midway.uchicago.edu>
- Date: Fri, 8 Jan 1993 18:43:13 GMT
- Lines: 38
-
-
- On Fri, 8 Jan 1993 15:53:56 GMT,
- ecr2@ellis.uchicago.edu (corprew reed) said:
-
- I was wondering if it was possible to find out the number of
- rows that a query will return before accessing the data without using
- 'count(.*)' with select. I have a large query that takes a while to
- execute, and I'm hoping to keep my application reasonably interactive
- by not executing it once for the count and once for the data.
-
- As far as I know this isn't possible although very desirable. Think
- about it this way, the server can't know what rows will match the where
- clause until it actually qualifies them. So it must evaluate your query
- to know how many rows. Since it is qualifying the rows, it immediately
- starts sending them off to you as soon as it can.
-
- This is what you really want. If there are 500,000 rows that match a
- complicated query you want to start seeing rows as soon as possible. The
- user sitting behind the application is not going to be pleased waiting
- for the 500,000 row to be qualified before he sees the first. This is
- the reason why you don't want to do the select count(*) now. It is also
- the reason that rows are returned immediately upon being qualified.
-
- I've written applications where I've done the count(*) first to inform
- the user what is happening. However, these was generally done for small
- tables where the user got to chose some information. For big results or
- small results with complicated queries it is a lot messier.
-
- The best you can do is keep track of where you are in the list, enable
- row buffering in dblib, implement your own row buffering, and wait for
- cursors (would they really help though).
-
- Good luck,
- Ed
- --
- Ex vitio alterius |Ed Hirgelt |esh@tss.com
- sapiens emendat suum. |Teknekron Software Systems, Inc|
- (Publilius Syrus) |Palo Alto, Ca. |
-