Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

sysusages table & math puzzle

5 posts in Windows NT Last posting was on 2000-05-24 07:17:51.0Z
Phil Schuman Posted on 2000-05-22 19:53:23.0Z
From: "Phil Schuman" <pschuman.NOSPAM@interserv.com>
Subject: sysusages table & math puzzle
Date: Mon, 22 May 2000 14:53:23 -0500
Lines: 51
Organization: Abacus Group
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <7LSmshCx$GA.304@forums.sybase.com>
Newsgroups: sybase.public.sqlserver.nt
NNTP-Posting-Host: 216-80-34-61.d.enteract.com 216.80.34.61
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2126
Article PK: 1089556

hi -
I'm trying to get the math right for interpreting the sysusages table.
and guessing at the data content :)

dbid segmap lstart size vstart pad
unreservedpgs
------ ----------- ----------- ----------- ----------- ------ ------------
-
9 3 0 25600 117440512 NULL
15464
9 4 25600 10240 134217728 NULL
10232
9 3 35840 26112 150994944 NULL
26112
9 4 61952 10752 167772160 NULL
10752

for our database - it lays down like this - -
50meg dat
20meg log
55meg dat
25 meg log
in the segmap, it looks like 3 = dat and 4 = log - right ?

VSTART is the virutal start of where the data lives,
but I can't get the numbers to really addup and match ?
ie size of 25600 == about 50meg dat - but not exactly....
size of 10240 == about 20meg log
size of 26112 == about 55meg dat
size of 10752 == about 25meg log

and I would have thought that the VSTART numbers
would increment up,
combining the SIZE to get to the next area segment ? but they don't ??
117440512 + 25600 = 117466112 ??

it looks like the increments between the segments listed is a constant
number ??
if we subtract the adjacent VSTART numbers, this is what I get ??
117440512
134217728 = 16777216
150994944 = 16777216
167772160 = 16777216

wish I could see this via ODBC...
ok - educate me on what I'm looking at :)

Phil-


Peter Veilleux Posted on 2000-05-22 20:21:54.0Z
Message-ID: <392996E2.A61702C8@nvestservices.com>
Date: Mon, 22 May 2000 16:21:54 -0400
From: Peter Veilleux <pveilleux@nvestservices.com>
X-Mailer: Mozilla 4.72 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: sysusages table & math puzzle
References: <7LSmshCx$GA.304@forums.sybase.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.sqlserver.nt
Lines: 58
NNTP-Posting-Host: nefclient200.mutualfunds.com 206.136.227.200
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2125
Article PK: 1089557


Phil Schuman wrote:

> hi -
> I'm trying to get the math right for interpreting the sysusages table.
> and guessing at the data content :)
>
> dbid segmap lstart size vstart pad
> unreservedpgs
> ------ ----------- ----------- ----------- ----------- ------ ------------
> -
> 9 3 0 25600 117440512 NULL
> 15464
> 9 4 25600 10240 134217728 NULL
> 10232
> 9 3 35840 26112 150994944 NULL
> 26112
> 9 4 61952 10752 167772160 NULL
> 10752
>
> for our database - it lays down like this - -
> 50meg dat
> 20meg log
> 55meg dat
> 25 meg log
> in the segmap, it looks like 3 = dat and 4 = log - right ?

yup, 3 is data only, 4 is log ony, 7 is data/log mix (see dbid 1)


>
>
> VSTART is the virutal start of where the data lives,
> but I can't get the numbers to really addup and match ?
> ie size of 25600 == about 50meg dat - but not exactly....
> size of 10240 == about 20meg log
> size of 26112 == about 55meg dat
> size of 10752 == about 25meg log
>
> and I would have thought that the VSTART numbers
> would increment up,
> combining the SIZE to get to the next area segment ? but they don't ??
> 117440512 + 25600 = 117466112 ??

to interpret the vstart numbers you need to look at sysdevices. vstart will
fall between high and low for whichever device the fragment is on. If it is
the first fragment, vstart will be the same as low. If it is the last fragment
vstart + size -1 will be the same as high.


>
>
> it looks like the increments between the segments listed is a constant
> number ??
> if we subtract the adjacent VSTART numbers, this is what I get ??
> 117440512
> 134217728 = 16777216
> 150994944 = 16777216
> 167772160 = 16777216

I'm going to take a shot in the dark and say all your disk inits were done for
the same size, correct? I'm not really positive why they all end up the same,
and I can't figure it out mathematically, either. Maybe if I had
sysdevices....


>
>
> wish I could see this via ODBC...
> ok - educate me on what I'm looking at :)
>
> Phil-

HTH,
Peter


Phil Schuman Posted on 2000-05-22 20:54:37.0Z
From: "Phil Schuman" <pschuman.NOSPAM@interserv.com>
References: <7LSmshCx$GA.304@forums.sybase.com> <392996E2.A61702C8@nvestservices.com>
Subject: Re: sysusages table & math puzzle
Date: Mon, 22 May 2000 15:54:37 -0500
Lines: 231
Organization: Abacus Group
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <dp$H7DDx$GA.304@forums.sybase.com>
Newsgroups: sybase.public.sqlserver.nt
NNTP-Posting-Host: 207-229-173-74.d.enteract.com 207.229.173.74
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2124
Article PK: 1089559


Peter Veilleux <pveilleux@nvestservices.com> wrote in message
news:392996E2.A61702C8@nvestservices.com...
> to interpret the vstart numbers you need to look at sysdevices. vstart
will
> fall between high and low for whichever device the fragment is on. If it
is
> the first fragment, vstart will be the same as low. If it is the last
fragment
> vstart + size -1 will be the same as high.

which command output would you like to see ?
here is the "sp_helpdevice"
Phil -


"Mark A. Parsons" <pegasys Posted on 2000-05-23 05:25:27.0Z
Message-ID: <392A1646.B93056D5@_internet.co.nz>
Date: Tue, 23 May 2000 17:25:27 +1200
From: "Mark A. Parsons" <pegasys@_internet.co.nz>
Organization: Pegasys (2000) Limited
X-Mailer: Mozilla 4.72 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: sysusages table & math puzzle
References: <7LSmshCx$GA.304@forums.sybase.com> <392996E2.A61702C8@nvestservices.com> <dp$H7DDx$GA.304@forums.sybase.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.sqlserver.nt
Lines: 28
NNTP-Posting-Host: p305.ipa1-n8-16.iconz.net.nz 210.48.25.49
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2123
Article PK: 1089528

Peter (I believe) was referring to the actual contents of master..sysdevices (as in 'select * from master..sysdevices').

One of the manuals should give you a quick run down on the contents of the individual system tables (e.g., sysdevices and sysusages).

As Peter mentioned, you have to look at sysusages and sysdevices together. sysdevices will give you the total size of a disk as well as it's l(ogical) address boundaries (l(ogical)start and size) as far as the dataserver is concerned. sysusages then defines the chunks of devices that have been allocated to specific databases ... sysusages.lstart showing where on the given device the 'chunk' starts.

If you look at the source code for sp_helpdb you should be able to figure out the relationship between these 2 tables as well as see how the numbers actually stack up. (You can find the source for sp_helpdb via 'sybsystemprocs..sp_helptext sp_helpdb' or 'defncopy ... sp_helpdb ... (from the OS command line)'.)

--
Mark A. Parsons

Iron Horse, Inc. iron_horse@compuserve.com
Pegasys (200), Ltd pegasys@internet.co.nz


"Mark A. Parsons" <pegasys Posted on 2000-05-24 07:17:51.0Z
Message-ID: <392B821E.5B92DDD8@_internet.co.nz>
Date: Wed, 24 May 2000 19:17:51 +1200
From: "Mark A. Parsons" <pegasys@_internet.co.nz>
Organization: Pegasys (2000) Limited
X-Mailer: Mozilla 4.72 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: sysusages table & math puzzle
References: <7LSmshCx$GA.304@forums.sybase.com> <392996E2.A61702C8@nvestservices.com> <dp$H7DDx$GA.304@forums.sybase.com> <392A1646.B93056D5@_internet.co.nz>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.sqlserver.nt
Lines: 72
NNTP-Posting-Host: p506.ipa1-n8-16.iconz.net.nz 210.48.25.250
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:2120
Article PK: 1089523

> As Peter mentioned, you have to look at sysusages and sysdevices together. sysdevices will give you the total size of a disk as well as it's l(ogical) address boundaries (l(ogical)start and size) as far as the dataserver is concerned. sysusages then defines the chunks of devices that have been allocated to specific databases ... sysusages.lstart showing where on the given device the 'chunk' starts.

Boy, did I mis-speak on that one ... well, at least on the column names ... *ack*.

sysdevices gives a disks 'low' and 'high' ... which sysusages.vstart (a physical address) must fall between (as Peter said). sysusages also has the 'lstart' number which represents the device's 'logical', or 'local', address in reference to the database to which it has been assigned.

As for your concern about the numbers not quite matching up to what you wanted, remember that 'size' refers to the number of 2K pages. So, your examples become:

size of 25600 => 25600*2048 => 52,428,800, which when divided by 1024*1024 (1 MB) gives you exactly 50 (MB)
size of 10240 => 10240*2048 => 20,971,520, which when divided by 1024*1024 (1 MB) gives you exactly 20 (MB)
.... etc., etc., etc.

As for the comment that adding 'vstart + size' should equal the next 'vstart' number for a database ... you almost got it. Actually what you do is add 'size' to 'lstart' to get the next 'lstart' number for the given database. You'll find that each database begins with 'lstart'=0 for it's first segment (entry in sysusages), from here each successive 'lstart' for this given database is determined by
adding 'size' + 'lstart' from the previous segment.

A database will handle all of it's addressing via 'logical' addressing, however, in order to work with a device the database has to know how to map it's 'logical' addresses to the actual physical addresses of the associated device ... hence the 'vstart' as a pointer into a device where the database's logical segment is mapped.

I guess if you wanted to add 'size's to 'vstart's you would want to take all entries from sysusages (regardless of database) for a given device (all 'vstart's between a given device's 'low' and 'high'), you should see that each successive 'vstart' is exactly 'size' pages larger than the previous 'vstart'.

The key to remember is that 'lstart's are 'logical' addresses and thus tied to a specific database. 'vstart's are physical addresses and thus tied to a specific device. 'size' is in terms of 2K pages. If you add 'size' to 'lstart' make sure you are comparing successive 'lstart's for the same *database*. If you add 'size' to 'vstart' make sure you are comparing successive 'vstart's for the same
*device*.

Clear as mud now?


--
Mark A. Parsons

Iron Horse, Inc. iron_horse@compuserve.com
Pegasys (200), Ltd pegasys@internet.co.nz