Friday, February 24, 2012

How I can to treat a largest table, db?

Hi All,
I have one doubt about largest database, largest tables etc.
For example:
I have one db that have a table with 10.000.000.000 (or more) of register,
and I need get each register and do same thing with it (think that db is
about a credit card and the registers are the transactions of customers, and
I need print the invoices)
If I try use SELECT * FROM. the dm return 10.000.000.000, this is not good.
How I get one by one of table.
How I can to treat (to manipulate) a largest table, db? What are the ways?
What are the tricks?
Can you show me?
ThanksHi,
Execute the system stored procedure with out parameters to get the size of
all databases
sp_databases
To get the actual usage of data and indexes then execute the below comand in
the context of a database.
sp_spaceused
For getting the size of table in order:-
select object_name(id) as Table_name,rowcnt as record_count
from sysindexes
where indid IN (0, 1)
order by rowcnt desc
TO get the correct result execute DBCC UPDATEUSAGE (see books online) before
the above select statement.
Thanks
Hari
SQL Server MVP
"ReTF" <re.tf@.newsgroup.nospam> wrote in message
news:OABd$z7aFHA.3808@.TK2MSFTNGP14.phx.gbl...
> Hi All,
>
> I have one doubt about largest database, largest tables etc.
>
> For example:
>
> I have one db that have a table with 10.000.000.000 (or more) of register,
> and I need get each register and do same thing with it (think that db is
> about a credit card and the registers are the transactions of customers,
> and I need print the invoices)
>
> If I try use SELECT * FROM. the dm return 10.000.000.000, this is not
> good.
> How I get one by one of table.
>
> How I can to treat (to manipulate) a largest table, db? What are the ways?
> What are the tricks?
>
> Can you show me?
>
> Thanks
>|||that table should have a key, and you should use the key for the record you
want
along with 'WHERE'
it works something like,
SELECT *
FROM bigtable
WHERE thekey = '123'
this will select only one record.
"Hari Prasad" wrote:
> Hi,
> Execute the system stored procedure with out parameters to get the size of
> all databases
> sp_databases
> To get the actual usage of data and indexes then execute the below comand in
> the context of a database.
> sp_spaceused
> For getting the size of table in order:-
> select object_name(id) as Table_name,rowcnt as record_count
> from sysindexes
> where indid IN (0, 1)
> order by rowcnt desc
> TO get the correct result execute DBCC UPDATEUSAGE (see books online) before
> the above select statement.
> Thanks
> Hari
> SQL Server MVP
>
> "ReTF" <re.tf@.newsgroup.nospam> wrote in message
> news:OABd$z7aFHA.3808@.TK2MSFTNGP14.phx.gbl...
> > Hi All,
> >
> >
> >
> > I have one doubt about largest database, largest tables etc.
> >
> >
> >
> > For example:
> >
> >
> >
> > I have one db that have a table with 10.000.000.000 (or more) of register,
> > and I need get each register and do same thing with it (think that db is
> > about a credit card and the registers are the transactions of customers,
> > and I need print the invoices)
> >
> >
> >
> > If I try use SELECT * FROM. the dm return 10.000.000.000, this is not
> > good.
> >
> > How I get one by one of table.
> >
> >
> >
> > How I can to treat (to manipulate) a largest table, db? What are the ways?
> > What are the tricks?
> >
> >
> >
> > Can you show me?
> >
> >
> >
> > Thanks
> >
> >
>
>

No comments:

Post a Comment