Difference in num_rows and COUNT function.
Hi Experts,
SELECT COUNT(*) FROM APP.Big_table; Number of record--222653402This is a big table to get the it's taking 8 minutes time,
so that I tried the following SQL to get the count quickly.
SELECT num_rows FROM all_tables WHERE table_NAME='BIG_TABLE'
and owner='APP'; --Number of records 237213998But I got the different count for the two SQLs.
Why there is a difference in the count.
Which one is correct.
Please help me.
Thanks in advance.
Why there is a difference in the count.Because num_rows depends on how often table statistics are refreshed.
Read about DBMS_STATS package.
http://www.oracle-base.com/articles/misc/cost-based-optimizer-and-database-statistics.php
Which one is correct.The real-time count is the 'most correct' one (select count(*)).
But in the time it takes to count all records, possibility is that records have been inserted/deleted as well, depending on the use of the table, so you'll will have an 'approximate count', it does not always reflect the exact number of records.
Similar Messages
-
DIFFERENCE BETWEEN SUM AND COUNT IN SQL
DIFFERENCE BETWEEN SUM AND COUNT IN SQL
WHAT IS THE DIFFERENCE VERIFY IN DETAIL/21031980, I suggest you upgrade your computer sothat you can access google.
lol.
wtfpwnd.Google is also helpful for understanding the strange
acronyms that show up around here lately (yes, I did
find and understand this one). :-)Haha, sorry!
It's the inner-gamer in me rearing its ugly head...
:-) -
Difference between Generic and Generating functions
Hi,
Can any body explain me the difference between Generic and Generating functions? Do also let me kwno which Standard functions are Genereic and which are Generating/
Regards,
PranshuHi Pranshu,
All functions (regardless of whether they are standard or user-defined functions) that do not have input values are refered to as Generating Functions (Constant, Sender, Receiver and CopyValue() are generating functions). All other functions are generic.
So, the standard XI functions can be generic or generating.
Hope this helps
Regards
Kiran.. -
Any difference between distinct and aggregate function in sql query cost???
Hi,
I have executed many sql stmts patterns- such as:
a) using a single table
b) using two tables, using simple joins or outer joins
but i have not noticed any difference in sql stmts in cost and in execution plan....
Anyway, my colleague insists on that using aggregate function is less costly compared to
distinct....(something i have not confirmed, that's why i beleive that they are exactly the same...)
For the above reffered 1st sql pattern.. we could for example use
select distinct deptno
from emp
select count(*), deptno
from emp
group by deptno select distinct owner, object_type from all_objects
select count(*), owner, object_type from all_objects
group by owner, object_typeHave you found any difference between the two ever...????
Note: I use Ora DB 10g v2.
Thank you,
Simdistinct and aggregate function are for different uses and may give same result but if u r using aggregate function to get distinct records, it will be expensive...
ex
select distinct deptno from scott.dept;
Statistics
0 recursive calls
0 db block gets
2 consistent gets
0 physical reads
0 redo size
584 bytes sent via SQL*Net to client
488 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
4 rows processed
select deptno from scott.emp group by deptno;
Statistics
307 recursive calls
0 db block gets
60 consistent gets
6 physical reads
0 redo size
576 bytes sent via SQL*Net to client
488 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
6 sorts (memory)
0 sorts (disk)
3 rows processed
Nimish Garg
Software Developer
*(Oracle & ASP.NET)*
Indiamart Intermesh Limited, Noida
To Get Free Oracle & ASP.NET Code Snippets
Follow: http://nimishgarg.blogspot.com -
XL Reporter and Count function
Hi,
Using XL Reporter to produce financial reporting and sales analysis reporting is great. It would be good to be able to use count functions as well for other data analysis (ie in Service modules) without having to drop out huge volumes of data from the database, hide it and use the Excel countif functions to analyse the data.
An example is to provide reporting on the number of service calls in a period analysed by Problem Types, by Item Groups, Top 10 customers by number of calls etc.
This is all good supporting reporting but it is resource hungry to produce using the existing methods.
Edited by: Julie Jamieson on Aug 1, 2008 3:26 PMHi you all
Thats right, im doing like you: hiding lots of data... but it would be great to use a count function.
For example, i am doing a report where i need to count the number of invoices made for a sale of type a manufacturer brand.
If anyone have a solution, please share it.
Thanks
Luis Barros -
What is the difference between SEOK and SEOF function group?
Best regards,
Blake LeHi,
All class data manipulations are done with function modules from SEOK package (ABAP Objects Class Builder Services). SEOF - ABAP Objects Class Library Database Layer
The following program will be helpfull to you.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3330a5e1-0701-0010-6e81-e88984de611a
Regards,
Jagadsih -
Dear All,
0PM_OM_OPA_1 this one will not support delta and it brings planned costs
0PM_OM_OPA_2 supports delta brings actual data
that means we should load only once 0PM_OM_OPA_1 and delta loads with actual data?
actually when iam loading both the data through both data sources the values are doubled (keyfigure values).
Please anybody can suggest me.
in standard version both the data sources are assigned to 0pm_c01 cube.
0PM_OM_OPA_1 either should be loaded daily with full load?
0PM_OM_OPA_2 should be loaded with delta daily?
pls can anybody give the clear picture.
Thanks & Regards,
Sathish
Edited by: sathish kakumudi on Feb 27, 2010 3:54 PMHi Vikram,
Thanks for your kind responce some more clarification i need from your end.
Please put a filter on value type 20 on the data from 0PM_OM_OPA_1 .
Here value type 20 means we will get planned data only that means at info package level i can keep selection and i should extract the only value type 20 data.
Do not use it to get actuals.
once i selected that value type 20 automatically i will not get actual data from 0pm_om_opa_1 it is correct?
that means in process chain for 0PM_OM_OPA_1 full load with restrictions of value type 20 ? agin it should be full load ,the load directly loading to cube so i can delete overlapping request property also?
0PM_OM_OPA_2 for this as usal delta daily load in this data source the value type should be 10?
pls can you clarify the above, am very thank ful to you.pls
any update pls
Thansk & Regards,
Sathish
Edited by: sathish kakumudi on Mar 1, 2010 3:16 PM -
Hi,
I want to get sum of a column, but it is giving wrong values when using sum and count functions. please help.
But in actual excel value is different.Hi,
Below is the derived table query:
select location,
SUM(case when priority='1'and sholders like '%niit%'then 1 else 0 end) as 'Total P1callsof NIIT',
SUM(case when Priority='1'and sholders like '%niit%'and sla_violation=0 then 1 else 0 end) as 'TotalResolvedcallsinBHRS NIIT'
from Stakeholders group by Location
Am calculating the sum of 'Total P1callsof NIIT' in a summary page, which gives me incorrect value(2349) where the actual count is 581. . -
Hello everyone,
I am using the following MDX query on one of my SSRS report.
SELECT NON EMPTY { [Measures].[Days Outstanding], [Measures].[Amt] } ON COLUMNS,
NON EMPTY { ([Customer].[Customer].[Customer Key].ALLMEMBERS) }
HAVING [Measures].[ Days Outstanding] > 60
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM ( SELECT ( STRTOSET(@Location, CONSTRAINED)) ON COLUMNS
FROM ( SELECT ( {[Date].[Fiscal Period].&[2014-06]}) ON COLUMNS
FROM [Model]))
Over here, the data is being filtered always for current month and for a location that is being selected by user from a report selection parameter.
I would like to get the count of total no. of customers and sum of the amount measure.
When I am using them in calculated members it gives incorrect values. It considers all records (ignores the sub-select statements) instead of only the records of current month and selected location.
I also tried with EXISTING keyword in calculated members but there is not difference in output. Finally, I manage the same at SSRS level.
Can anybody please advise what are the ways to get the required sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension?
Also, does it make any difference if I manage it as SSRS level and not at MDX query level?
Any help would be much appreciated.
Thanks, Ankit Shah
Inkey Solutions, India.
Microsoft Certified Business Management Solutions Professionals
http://www.inkeysolutions.com/MicrosoftDynamicsCRM.htmlCan anybody please advise what are the ways to get the required sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension?
Also, does it make any difference if I manage it as SSRS level and not at MDX query level?
Hi Ankit,
We can use SUM function and COUNT function to sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension. Here is a sample query for you reference.
WITH MEMBER [measures].[SumValue] AS
SUM([Customer].[Customer].ALLMEMBERS,[Measures].[Internet Sales Amount])
MEMBER [measures].[CountValue] AS
COUNT([Customer].[Customer].ALLMEMBERS)
MEMBER [Measures].[DimensionName] AS [Customer].NAME
SELECT {[Measures].[DimensionName],[measures].[SumValue],[measures].[CountValue]} ON 0
FROM [Adventure Works]
Besides, you ask that does it make any difference if I manage it as SSRS level and not at MDX query level. I don't thinks it will make much difference. The total time to generate a reporting server report (RDL) can be divided into 3 elements:Time to retrieve
the data (TimeDataRetrieval);Time to process the report (TimeProcessing);Time to render the report (TimeRendering). If you manage it on MDX query level, then the TimeDataRetrieval might a little longer. If you manage it on report level, then the TimeProcessing
or TimeRendering time might a little longer. You can test it on you report with following query:
SELECT Itempath, TimeStart,TimeDataRetrieval + TimeProcessing + TimeRendering as [total time],
TimeDataRetrieval, TimeProcessing, TimeRendering, ByteCount, [RowCount],Source
FROM ExecutionLog3
WHERE itempath like '%reportname'
Regards,
Charlie Liao
TechNet Community Support -
Difference between ME_READ_PO_FOR_PRINTING and ME_PRINT_PO
I just saw these 2 function modules in standard PO printing program SAPFM06P. Can someone please let me know whatz the difference between ME_READ_PO_FOR_PRINTING and ME_PRINT_PO function modules...
Hi friend......
The function module ME_READ_PO_FOR_PRINTING is used to read the PO
The function module ME_PRINT_PO is used to print the PO
if u want let u know some more information
How can i get PO partner functions using FM ME_READ_PO_FOR_PRINTING
http://sap.ittoolbox.com/groups/technical-functional/sap-log-mm/tcode-me9f-user-exit-exit_saplmedruck_001-617362 -
Hi Experts,
I want to know the difference between RV_PRICE_PRINT_ITEM and RV_PRICE_PRINT_ITEM_BUFFER function modules.
Both FMs are meant to fetch all pricing condtions for document.
Thanks in advance,
SagarIn the calculation schema you can customize your conditions. E.G: if they shall be printed or not.
So the FM gets you back two tables of conditions.
TKOMV (ALL of em)
TKOMVD (Just the ones that are marked as to be printed)
Those ones from TKOMVD are the ones you need for invoice printing.
But for calculation issues or whatever you may need to have a look at some conditions which are not marked as to be printed and so you get TKOMV back to be able to do so. -
Hi All,
Can anyone tell me what is the difference between PA40 and PA41 functionality. Where we use PA40 and where PA41.
Regards,
KumarMr. Kumar,
PA40-Actions
PA41-Change of Actions
itself denoting what it functions....Check how it functions in SAP.
Not only changing of the date of Hiring/Leaving.
You need to know change of actions can be done in actions, But the change of actions cannot effect the dynamic actions.
thanking you, -
What is the difference between count(*) and count(1)
what is the difference between count(*) and count(1)
Hi,
903830 wrote:
some say count(1) is faster and some say count(*), i am confused about count function?In the link provided by Prakash :
prakash wrote:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1156159920245
You can read :
Followup August 31, 2001 :
I'll have to guess, since you don't say, that you are using 7.x and before when count(*) and count(1) were different (and count(1) was slower). In all releases of the databases for the last 4-5 years, they are the same.
Don't waste your time on that.
;-) -
1)Now I use Lightrom 5.7 how to upgrade to 6 or CC?
2) What is the difference between 6 and CC version?
3) When I used lightromm 3, I could see in EXIF the distance in meters till the object I took, in the later virsions that function disappeared, it is very sad I am stiil waiting and hope that it would be possibble in the new versions. Or this indication may possible by setting?1)Now I use Lightrom 5.7 how to upgrade to 6 or CC?
Purchase the standalone upgrade from here: Products
Download CC version from here: Explore Adobe desktop apps | Adobe Creative Cloud
2) What is the difference between 6 and CC version?
See this comparison chart: Compare Lightroom versions | Adobe Photoshop Lightroom CC
3) When I used lightromm 3, I could see in EXIF the distance in meters till the object I took, in the later virsions that function disappeared, it is very sad I am stiil waiting and hope that it would be possibble in the new versions. Or this indication may possible by setting?
Rob Cole's ExifMeta plugin displays the Subject Distance field (and much more). Unfortunately, his Web site appears to be down again. He used to be very active here, but he hasn't posted in several months. -
Why the difference in the Photos app functionality between the iPad 2 and iPhone 4?
Photo Stream works well on my iPad 2. For whatever reason, iPad 2 has more functionality in the iOS 5 "Photos" app than the iPhone 4. This may be because my iPad is 64GB and the iPhone is 32GB. Nevertheless, the iPad has the following folders in the Photos app (the first four of which match OSX iPhoto on the Mac in numbers of photos; only the order of matches in the Photo Stream folder; the last folder is not in iPhoto, or is not readily displayed there as far as I can tell):
"Photos" - corresponding to the Photos folder in iPhoto Library (not in the same order)
"Photo Stream" - virtually identical to Photo Stream in iPhoto
"Albums" - same as in iPhoto, including "Last 12 Months" and "Last Import"
"Events" - about one quarter the number of Events (groupings of photos) as are listed in iPhoto
"Places" - not displayed in iPhoto, as far as I can tell
The Photos app in the iPhone only lists "Albums," starting with Camera Roll and Photo Stream, with the option of adding more albums (no option to delete) - but not like the Albums that are displayed on the iPad.
What accounts for this difference between iPad and iPhone?Thanks for the report.
Maybe you are looking for
-
How to move ALL musical content from old PC to new Mac
Sorry if this has been asked a million times before, but since iTunes has been updated and processes get changed/revamped, etc., please let me know your opinion on this: I am getting my first-ever Mac. I want to move my approximately 2,600 songs from
-
Adding new value in Pick list and sorted logic on basis of new value.
Hi All, I have a requirement where I have to add a new value in seeded OAMessageBean and sort the page contents on basis of selected value. I see in about this page and found out that no VO is attached with this field. I assume that it attached somew
-
My Mac Mini will not read TDK disks from my iMac G3.
My Mac Mini will not read TDK disks from my iMac G3. I used an iMac G3 (2001) -- the ones that looked like a big pod -- running on OS X and saved files to TDK CD-R, 700 MB disks, which worked fine. Now that I have a Mac Mini (model number A1347) I
-
Simultaneous hash joins of the same large table with many small ones?
Hello I've got a typical data warehousing scenario where a HUGE_FACT table is to be joined with numerous very small lookup/dimension tables for data enrichment. Joins with these small lookup tables are mutually independent, which means that the resul
-
I'm new at using Adobe 9 Pro to create .pdf files so your patience is appreciated. Have a 400 page Word 2007 document (policies and procedures) which I convert to Adobe using my styles (not the standard Heading 1, 2, 3 etc.) to create bookmarks. Wo