Invictus
Invictus

Reputation: 4328

How to find the size of a row in a table in databse(Sybase)

I wanted to know the command to find the size of a row in a table in my database. Say I've a database db and a table table.

How can i find the size of a row in that database (which includes all the columns)?

Upvotes: 1

Views: 8051

Answers (2)

Hotel
Hotel

Reputation: 1371

In ASE, I use a combination of sp_estspace and sp_spaceused for total Data / index sizing that I wrote myself. You can grab the source for each inside sybsystemprocs.

sp_estspace tends to overestimate (by a lot) the size of the data (not indexes) and sp_spaceused divided by rowcount tends to not be a good indicator of how big a row could potentially be today (imagine you added 20 nullable columns yesterday and decide to use them, spaceused is unchanged).

  1. reasonable expected data size = ((spaceused / rowcount) + estspace(1) ) / 2
  2. I haven't done any analysis about the accuracy of either index commands, but I would imagine (spaceused / rowcount) would be very accurate for forward looking items.

It's not perfect by ANY means, but it's been a fairly reliable estimate for my purpose. I wouldn't write any code that would break if it exceeded any of these estimates, though.

Upvotes: 0

Java
Java

Reputation: 2489

For Displaying the expected row size for a table See here

Upvotes: 2

Related Questions