Find Total Number of Rows in Database
I am trying to find total number of rows in Database? Thanks in advance
I'd come back to a question of "why". What possible reason could you have to want to know the number of rows in every table in the database?
This seems like it is a request from someone non-technical where they're not sure exactly what they need to ask to get the information they want. I'm forseeing something along the lines of
User: How many rows are in the database
DBA: Ummm.... <<goes off and spends a lot of resources to count>>> ... 1 billion.
User: Wow, that's a lot... How big are those rows...
DBA: Hmmm... <<goes off and spends more time trying to find an average row size>>... 100 bytes
User: <<Plugs numbers into Excel>>... OK, our database is 93 GB, so we need to order 100 GB of disk for our new environment.
DBA: <<Months later, after 100 GB of disk has been budgeted, purchased, and delivered>> User, you didn't order enough disk for our disaster recovery environment.
User: You said our database was only 93 GB!!
DBA: 93 GB of data. Plus 100 GB of indexes, TEMP, UNDO, space for archived logs, ...
When "odd" requests come down, it's generally the case that the person asking the question doesn't know what question they really want to ask because they don't have the domain knowledge to know how to ask the question. Walking over and asking them what they're hoping to accomplish/ what they're using the data for generally leads to a case where
- The user gets exactly the information they need, not the information they think they want
- The DBA does a lot less work, since the right question is almost always easier to answer
- The user thinks of the DBA as a really helpful sort of guy and remembers how helpful you were in the past when you have to push back on other things later
- No one ends up playing the blame game when the user gets just what they asked for and not what they want.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
Similar Messages
-
Total number of record in database??
Hi,
How to find total number of record in database using Single Query/Statement?
ThanksHere we go, in a Single Statement Block
SQL> ed
Wrote file afiedt.buf
1 DECLARE
2 v_cnt NUMBER := 0;
3 v_tot NUMBER := 0;
4 CURSOR cur_tables IS
5 SELECT table_name FROM user_tables;
6 BEGIN
7 DBMS_OUTPUT.ENABLE(1000000);
8 FOR t IN cur_tables
9 LOOP
10 EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM '||t.table_name INTO v_cnt;
11 v_tot := v_tot + v_cnt;
12 END LOOP;
13 DBMS_OUTPUT.PUT_LINE('Total Table Rows: '||v_tot);
14* END;
SQL> /
Total Table Rows: 5850553
PL/SQL procedure successfully completed.
SQL>What use it is is anybody's guess.
Note: This only works on the users own tables, not all the system tables or tables from other schemas in the database. -
Trying to find the number of rows in a ResultSet
I am trying to find the number of rows in a ResultSet, using the following code:
rs = st.executeQuery(query);
rs.last(); // to move the cursor to the last row
System.out.println(rs.getRow());
However, I am getting this error:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unsupported method: ResultSet.last
Whats going wrong??praveen_potru wrote:
You might have not used scrollable result set..
Try like this:
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);rs = stmt.executeQuery(sqlString);
// Point to the last row in resultset.
rs.last();
// Get the row position which is also the number of rows in the ResultSet.
int rowcount = rs.getRow();
System.out.println("Total rows for the query: "+rowcount);
cheersAnd I hope the OP would read it because the thread is a year old. -
Can we find the number of rows in table from the dump file
Hi All,
Can we find the number of rows in table from the dump file with out importing the table in to the database?
Please let me know ,if any option is there.
Thanks,
Kumar.<s>Try to import with option SHOW=Y, that should skip the number of rows which are into a table from a dump file.</s><br>
<br>
Nicolas.<br>
Oops, sorry, that doesn't show the number of lines...<br>
Message was edited by: <br>
N. Gasparotto -
Is there anyway of getting the total number of rows in the database via JDBC on a MySQL database?
thanks guys for your help but since my returned result set is huge anything that has to load the whole result set in memory is absolutely out of the question.
For my situation what DrClap suggested works wonders. I use
SELECT COUNT(*) FROM SomeTable
and then
count = rs.getInt(1);
This way I get the total number of rows plus its really quick.
Thanks DrClap -
TableView Control(finding total no of Rows & Columns)
Dear ALL SDN Members,
Please tell me the method by which we can obtain total no. of rows and columns in TableView control.Hi,
You can use Describe internal table to find the Number of Rows in the table control.or tablecontrol-lines will give the number of rows.
for getting the number of columns you have to call the FM <b>REUSE_ALV_FIELDCATALOG_MERGE</b>
data: v_lines type i.
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'ITAB'
I_INCLNAME = sy-repid
changing
ct_fieldcat = IT_FIELDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
describe table it_fieldcat lines v_lines.
now v_lines will have the number of columns.
Regards
vijay -
Hw to find total number of records
Hi All,
Can anyone help from these
1. how to find total number of reports for a particular cube/ods... need step - step solution
2. how to find total number of records for a particular Cube and ODS and Aggr's to till date.
3.what is sandbox,mirror sys,instance of a sys..?
4.what r TWS(Tivoli Workload Scheduler) jobs? how these r different to standard schedulers?
Thanks in ADv
LindaHello Linda,
As you have lots of answers on first 2 so i'll start from 3rd onward.
3. Sandbox is mostly practice system where you can do all kind of R&D, mirror sys can be mirror image of any system depends on the organization and instance of system is again mirror image of one system.
4. TWS is third party tool for scheduling which doesn't come along with SAP like standard scheduler as TWS has been prepared specially for this purpose so it has some more features than standard.
Hope it helps.
San. -
Need to Find Total number of InfoPart form in our Web application
Hello,
We have to find total number of Infopath forms in our web application. IS there any Power sheell Scripts or anuthing which can output the Infopath Forms location and file count .
Thanks
KundanHow about something like:
Get-SPWebApplication http://yourWebAppUrl |
Get-SPSite -Limit All |
Get-SPWeb -Limit All |
Select -ExpandProperty Lists |
Where { $_.GetType().Name -eq "SPDocumentLibrary" -AND -NOT $_.Hidden } |
Select -ExpandProperty Items |
Where { $_.Name -LIKE "*.xsn" }
Select {$_.Web.Url}, Url
The above will list all of the files. Do you need counts by library, by site or other?
Mike Smith TechTrainingNotes.blogspot.com -
To find total number of files inside folder
Hai,
In knowledge management is there any option to find total number of files inside folder...
I also want to see the recently uploaded and modified documents in a seperate iview...
Iam using NW2004s SP8..
Very urgent..
Waiting for a positive reply..
Thanks®ards,
Kiruthika.SHi Kiruthika,
1. You only need the configarchive if you don't want create all the KM configuration objects mentioned in the guide manually. So, just create the objects mentioned there and you don't need the configarchive
Also, the scenario works also on 2004s.
2. Please check this thread on how to show the total number of files inside a folder:
https://forums.sdn.sap.com/thread.jspa?threadID=19610
3. It would be nice if you would consider rewarding the time people like Saravanan spend to investigate and answer your question by assigning points via the colored stars.
Best regards,
Robert -
Display the total number of rows for the report in OBIEE 11g
Hi, In obiee 11g, the pagination will be 1-25. Is there any possiblity in obiee to show the total rows count next to pagination. Ex: if the result contains 120 rows. it should display after the pagination
Records 1-25. Total of Records : 120
Is there any way we can display the total number of rows for the report.
Kindly help me.. Its very urgent requirement.
MAny Thank in advacneCheck this http://obiee100.blogspot.com/2011/07/display-total-number-of-records-in.html
and
http://docs.oracle.com/cd/E28280_01/bi.1111/e10544/appsql.htm#CHDCDIDA
You have to go something like as suggested in previous link.
Mark as correct/helpful -
Count total number of rows present in the schema
Count total number of rows present in the schema including table, sequence, view
Desirable Output
table Sequence Views
1000 20 1000You mean You need to count the No of Tables, View and Sequence Present in the Schema ??
Hi Some thing like this,
SELECT a.view_cnt AS "View Count", b.tab_cnt AS "Table Count",
c.seq_cnt AS "Sequence Count"
FROM (SELECT COUNT (*) view_cnt
FROM USER_VIEWS) a,
(SELECT COUNT (*) tab_cnt
FROM USER_TABLES) b,
(SELECT COUNT (*) seq_cnt
FROM USER_SEQUENCES) cWhich give you,
View Count Table Count Sequence Count
153 878 32Thanks,
Shankar
Edited by: Shankar Viji on Aug 28, 2012 3:03 AM -
hi
Is there any way to get total number of rows fetched along with
result set in a single query
josHi,
You are referring to "Analytical Functions"
COUNT(*) OVER ()the above one your are counting the number of records, with respect to logical parition window -as if you specify with it the over clause. it won't provide the information as required, with respect to the your first post.
- Pavan Kumar N -
How to set total number of rows of table control
Hi All,
I want to set the total number of rows of table control. I don't want to display the blank rows in table.
Regards,
ShrinivasNeed some fine tuning regarding the scrollbar height but it's a start
Unless this isn't what you asked for
Small number of rows
Large number of rows
Attachments:
PlayingWithTable.vi 17 KB -
How to find total number of records in a BDoc?
Dear all,
I have replicated about BP 1088 records from ISU into CRM system with block size 100. Technically on SMW01, for each successfully processed BDoc, there will be 100 records (corresponds to 100 block size). But due to some failed BDocs, not all "successfully" BDocs will have 100 records each, some may have only 1 record inside...or 30...or 88 for example. So, may i know how to find or is there a report i can look into to find the total number of records clearly shown for each of the successfully processed green status BDocs???
Please help and points will be rewards!!
Thank You
Best Regards,
CKI am just showing this to show how to get the rowcount along with the cursor, if the program has so much gap of between verifying the count(*) and opening the cursor.
Justin actually covered this, he said, oracle has to spend some resources to build this functionality. As it is not most often required, it does not makes much sence to see it as a built-in feature. However, if we must see the rowcount when we open the cursor, here is a way, but it is little bit expensive.
SQL> create table emp_crap as select * from emp where 1 = 2;
Table created.
SQL> declare
2 v_cnt number := 0;
3 zero_rows exception;
4 begin
5 for rec in (select * from (select rownum rn, e.ename from emp_crap e) order by 1 desc)
6 loop
7 if v_cnt = 0 then
8 v_cnt := rec.rn;
9 end if;
10 end loop;
11 if v_cnt = 0 then
12 raise zero_rows;
13 end if;
14 exception
15 when zero_rows then
16 dbms_output.put_line('No rows');
17 end;
18 /
No rows
PL/SQL procedure successfully completed.
-- Now, let us use the table, which has the data
SQL> declare
2 v_cnt number := 0;
3 zero_rows exception;
4 begin
5 for rec in (select * from
6 (select rownum rn, e.ename from emp e)
7 order by 1 desc)
8 loop
9 if v_cnt = 0 then
10 v_cnt := rec.rn;
11 dbms_output.put_line(v_cnt);
12 end if;
13 end loop;
14 if v_cnt = 0 then
15 raise zero_rows;
16 end if;
17 exception
18 when zero_rows then
19 dbms_output.put_line('No rows');
20 end;
21 /
14
PL/SQL procedure successfully completed.Thx,
Sri -
To find total number of pages in XML publisher
1. Is there any method to find the total number of pages in BI or XML publisher.
2. Is there any method to to repeat the column(Not rows) on every page.For eg you have table with two columns say "A" and "B" .I want to repeat this B in every page . And A should print only in first page.
3. Is there any method to print a text say "ABC" only on first page footer based on condition.
Thanks
WazidExactly what my requirement is- In my template i have set header and footer page setup as "different first page'" and also printing the user text at the bottom of the last page using <?start@last-page-first:body?> <?end body?>.When i run the template, for multiple pages output user text is displaying at the bottom of the last page that is working fine but for single page output user text is not displaying at the bottom of the page because of the ""different first page'" header and footer.If you have any idea please suggest.
Maybe you are looking for
-
How do you create two apple ids for one email address.
I bought two i pads for my kids. Since we have just one email address, everytime I try to create a new apple id it says I already have one. They need separate ids so their friends can facetime with one and not the other. Can't figure out how to creat
-
Hi folks, I have a minute of video that I am trying to import as a PNG image sequence. Crash. Crash. Crash. If anyone has time to test ... Alright .. 5 minutes later .. import sequence to stage OK .. Save OK .. Now this is what happens when publi
-
Number of Query parameters problem
Ok, so I have a form that has always has one of two values filled in, but a different number of parameters in the rest. Example: The user will have to fillin (City) and (State), or (zipcode) to do a query. But they can also fill in the (numOfBedrooms
-
KM Upload in Portal 7.3
Hello, I found several tutorials online how to build an upload function to KM with a simple Java web project. However, all of them are based on the 7.0 KM API. Now Im having a hard time finding all the required JAR files, if I import the old ones, ar
-
SATA 7/8 not showing up with the Z77A-GD65
I've recently purchased a new system, and everything runs smoothly other than the fact that my computer is seemingly unable to recognise any devices plugged into the SATA 7/8 ports on the mainboard. I'm trying to install an SSD as a boot drive. I've