counting the values of columns, partial keys, and total rows just once

Signed-off-by: Smita Kumari <kumarismita62@gmail.com>