Re: How can I count rows fast ?
Date: 18 Jun 94 00:22:43 GMT
Message-ID: <32278_at_uswnvg.uswnvg.com>
Thanks. I guess I should clarify what I said.
I am talking in terms of the way ORACLE stores the data. ORACLE does not store blanks nor pad the stored data with blanks (version 6 or VARCHAR in version 7). That means you have a variable record length. THAT was my assumption when I wrote that.
I am aware that if you have a fixed structure, you can perform some calculations to get the number of records. (When I said fixed structure, I mean we know the structure and we can get some sort of algorithm to use that information)
Kim Ng
(Just a low life contract programmer. Thus, my clients won't adopt my views.)
Jae W. Chang (jae+_at_CMU.EDU) wrote:
: kimmng_at_uswnvg.com (Kim Ng) writes:
: > I do not understand how a computer can count something without going through
: > the whole table (unless, of course, if there is a counter somewhere that is
: > being kept --- I probably won't trust that counter anyway --- or you only
: > want to count records that match a certain criteria).
: >
: > Logically, it will have to go through the whole table from top to bottom
: > (like a person counting how many fingers he/she have). Any other way would
: > be just guessing.
: >
: > I would love to hear if there is a short cut. I am sure billions of others
: > would too.
: Well, I haven't been following the entire thread, but it depends on
: implementation, how data structures are defined, other variables, etc.
: If you wanted to count # of rows of constant size in a table,
: calculate the size of table and divide by size of rows, eg.
: Given certain constraints, assumptions, hacks, etc. you CAN count w/o
: doing the human equivalent of counting w/ fingers.
: Jae
: --------------------------
: jae+_at_cmu.edu
Received on Sat Jun 18 1994 - 02:22:43 CEST