How could Cylinder index scan achieve the "select count(*) from table X" ?

Database
Fan

How could Cylinder index scan achieve the "select count(*) from table X" ?

As far as i know, since TD 13, CI is used for "select count(*) from table x" instead of full table scan. But from the manual, 

CI stores below information , But i do not undertand how TD get the row count from below information ?

My concern is  : 1) same rowhash could have different rowID  2)rowhash value may not be simply increased by 1, like 1,2,3, it may be 1,5,8.

so, how could TD get row count from the Cylinder Index  ? Does it keep any other more information  ?

Each cylinder index entry contains the following data sorted on table ID and rowhash.

Table ID for the table stored in the block (rows from different tables are never mixed in the same data block)

Lowest rowID value in the block

Highest partition/rowhash value in the block

The partition is 0 for NPPI tables.

Sector number for that block

Number of sectors in the block

2 REPLIES
Junior Supporter

Re: How could Cylinder index scan achieve the "select count(*) from table X" ?

Hi.

The Cylinder Index contains:

The Subtable Reference Descriptors (they have the Table ID and the range of Data Block Descriptors).

The Data Block Descriptors have the Row count (a data block can only contain rows of one table).

The sum of the rowcounts of the DBD for a table can be extracted from the Cylinder Index.

HTH.

Cheers.

Carlos.

Fan

Re: How could Cylinder index scan achieve the "select count(*) from table X" ?

Thanks a lot for the output, Carlos!