Re: How do I identify a tables dbspace?
Posted in 1997
David Ferguson wrote: > > G'day all. Our site routinely performs "alter table to index" for > increased performance. I would like to run an SQL query to check > that enough space is available in the tables dbspace as part of an > automatic script. It's a bummer to have the command run for 4 hours > and then have it rollback because of a free space problem. Any way > to get this info out of the sysmaster tables? > > I think I can write the query once I know how to identify the dbspace > that the table belongs to. > > Any comments, suggestions, help would be greatly appreciated. > > Thanks, Dave Dave, I run this sort of query quite a bit, and there is a way to find out. SELECT SUM(nfree) FROM syschunks c, systabnames t WHERE t.tabname = "my_table" AND t.dbsname = "my_dbname" AND ROUND(t.partnum/1048576,0) = c.dbsnum; This will sum the number of free pages of all the chunks allocated to the dbspace in which your table resides. -- Rick Ward Senior DBA Great Universal Stores Home Shopping MANCHESTER, UK