EFFECIENT WAY OF GETTING COUNT

Hi All,
I have a table with millions of records with approximately 50-60 thousand new records being inserted everyday.
There is a DATE(RUN_DATE) field where the in which current days date is populated when records are being inserted.
Please let me know an effecient and optimized way of getting a count of the records that are being inserted.
Currently I am taking a count on TRUNC(RUN_DATE) = TRUNC(SYSDATE) which is not optimized and taking a lot of time.
Please suggest an efficient way of taking the count.
Thanks & Regards.

>
I have a table with millions of records with approximately 50-60 thousand new records being inserted everyday.
There is a DATE(RUN_DATE) field where the in which current days date is populated when records are being inserted.
Please let me know an effecient and optimized way of getting a count of the records that are being inserted.
>
What process are you using to insert those records? SQL*Loader? External Table? PL/SQL? Other?
The best time to get the count of inserted records is when the records are first inserted.
Modify the load process that inserts the records to capture the count.
If you use sql*loader or external tables they provide the counts for the inserts.
And if you use PL/SQL then the INSERT query will return the count in the %ROWCOUNT cursor attribute. Capture the count immediately after the query executes and write it to a table (assuming you COMMIT the transaction).
See the PL/SQL Language Doc
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/sql_cursor.htm
>
%ROWCOUNT
Returns the number of rows affected by an INSERT, UPDATE, or DELETE statement, or returned by a SELECT INTO statement.
>
If you have to manually get the count then just run your query once a week to get the counts for the week. It seems unlikely that you really need to have the count every single day.

Similar Messages

  • Fastest way to get count

    Hi
    I am having big table "BT" around 5,00,000 records in a table. this table is having various columns
    a, b,c,d,e,f,g .....etc
    I am having following indexes on a table
    1/ unique index a, b, c, d, e, f, g
    2/ index a, b, c, d
    3/ index a, b
    4/ index a, o,p,q
    5/ index r, s, t, u, v
    I am doing count(*) on a table where e = < some condition > and g = dt
    It is doing fast index full table scan. But it is taking more than 30 mins.
    I can not activate parallel query option. Can it be done faster way ?
    thanks & regards
    PJP

    The only index that contains both e and g is the first one and it's pretty wide. I agree with cd, you should try an index on g,e or e,g. remember, the order of columns in an index is a strategic decision so you need to consider things like the uniqueness of e and g. In general put the more unique one first. You also need to consider how often e and g are used in other queries. In general, the column referenced in the where cluse of the most queries should be placed first. The 2 general recommendations I mention sometimes contradict each other and that is where you need to make a judgement call

  • Simplest way to get count

    What is the simplest way to record a count of hits to a Web
    page that is platform-independent, secure and client-friendly?

    DECLARE
      CURSOR c_tablename IS
        SELECT table_name FROM user_tables WHERE table_name = 'EDI_850_HDR';
      v_count     NUMBER := NULL;
    BEGIN
      FOR r_tablename IN c_tablename
      LOOP
        EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || r_tablename.table_name
          INTO v_count;
        DBMS_OUTPUT.put_line('v_tablename : ' || v_tablename || ' : count : ' ||
                             v_count);
      END LOOP;
    END;

  • Most efficient way to get row count with a where clause

    Have not found a definitive answer on how to do this.  Is there a better way to get a row count from a large table that needs to satisfy a where clause like so:
    SELECT COUNT(*) FROM BigTable WHERE TypeName = 'ABC'
    I have seen several posts suggesting something like 
    SELECT COUNT(*) FROM BigTable(NOLOCK);
    and 
    selectOBJECT_NAME(object_id),row_count from sys.dm_db_partition_stats
    whereOBJECT_NAME(object_id)='BigTable'but I need the row count that satisfies my where clause (i.e.: WHERE TypeName = 'ABC')

    It needs index to improve the performance. 
    - create index on typename column
    - create a indexed view to do the count in advance
    -partition on type name (although it's unlikely) then get count from the system tables...
    all those 3 solutions are about indexing.
    Regards
    John Huang, MVP-SQL, MCM-SQL, http://www.sqlnotes.info

  • Any way to get the mail app to get updated message counts for other folders

    I've been wondering if there's a way to get the mail app to not only check if new mail exists in my main "inbox", but also all of the folders on my imap server? I can individually visit each folder I'm interested in and while it works, I have to guess what folders might have mail in them.. It would be great to have the phone check all folders (or perhaps a list of subscribed folders) for new mail on a regular basis.. Any ideas?

    I have opened a wrap-up thread related to the issue reported here and in many other threads -- "iPhone Mail does not poll IMAP subfolders for server-side processed e-mails": http://discussions.apple.com/thread.jspa?threadID=1355852

  • Starting Fresh With iTunes 9.0.1...best way to get music back in/import?

    Had some library troubles with iTunes 9, and decided to do a clean install of not only the program, but of Snow Leopard itself. I was waiting on an iTunes update to come out before I decided to re-load my library in, since I didn't want to risk repeat problems (I've always been one of those bleeding edge-ers, and this is the 1st time I've ever had a problem/held back...guess I learned my lesson). 9.0.1 is out and seems to address the problems I'd been having, but I caught the "start fresh" bug and I want to start over with iTunes. No playlists, play counts, etc need to be saved.
    I do have a full backup of my previous system (thanks SuperDuper!), and I'm wondering what the best way to get all of my music back into iTunes is.
    -Do I use the Finder to simply drag the contents of my old "iTunes Music" folder into the new "iTunes Media" folder?
    -Do I drag the whole folder and drop it onto the iTunes window? (I'm worried this method won't put iPhone apps, ringtones, audiobooks and podcasts in the right place).
    -Do I use the import function?
    Notes: prior to making the backup, I did upgrade to/select iTunes Media Organization
    I did see THIS article: http://support.apple.com/kb/HT1451 but it says it's old and I wonder if it applies to iTunes 9.
    Thanks for any help!

    You might want to check that your certificate that you made has been applied to iTunes.app
    try this code in Terminal"
    codesign -dvvvv /Application/iTunes.app
    Does the name on the certificate match the one you created?

  • Is there any way to get the "dictation" functionality of iPhone 4S to work on an iMac computer?

    The iphone dictation feature is great. It is available on 4s, but not 4 or earlier phones.  It is able to keep up with a normal speaking voice, and even counting the time to correct the (few) errors in the transcription, one can create text much faster than even the fastest typist.  I know Dragon has software for this.  Might there be a way to get dictation to work on a Mac wihtout having to buy the Dragon software?

    Hello:
    What you are describing is, I think, a function of iOS.  OS X does not have that capability (to my knowledge, at least).
    Barry

  • Way to get access to the context menu

    I assume there is no official way to get access to the context menu, so you can add a menu item when, say, you right-click on a photo in the publish service collection. You can tweak the behaviour for the two existing items, but there does not seem to be a way to add your own.
    Regular menu Export, Library, Help menu items are too coarse, as they apply across the whole app. It would be nice to be able to add an item that invokes a script to do some stuff to the item.
    I can hack in a workaround using the various edit collection callbacks, but this is a kludge of the highest order.

    Context menu access would be nice. If squeaking helps, maybe an FR - I've already cast one, and assume Adobe only counts one per person...

  • Best way to get bytes from a ByteBuffer

    Hi,
    I see three possible ways to get the bytes from a ByteBuffer in a new byte array. (if I get the backed array, a change in that array will change the ByteBuffer, that's why I insist on new array).
    1. System.arraycopy on the backed array
    2. clone() on the backed array
    3. use ByteBuffer's get() method
    Which one is the best in terms of performance ?
    Thank you for any tips.

    This Java tip demonstrates a method of getting bytes from a ByteBuffer. A ByteBuffer has a capacity that determines how many bytes it contains. This capacity can never change. The bytes in a ByteBuffer can also be retrieved using the relative version of get [cheapest wow gold|http://www.wowgoldstudio.com/] (), which uses the position and limit properties of the buffer. In particular, this version of get() retrieves the byte at the position and advances the position by one. get() cannot retrieve bytes past the limit (even though the limit might be less than the capacity). The position is always <= limit and limit is always <= capacity.
    [cheap wow gold|http://www.wow-goldstore.com/]
    // Create an empty ByteBuffer with a 10 byte capacity
    ByteBuffer bbuf = ByteBuffer.allocate(10);
    // Retrieve the capacity of the ByteBuffer
    int capacity = bbuf.capacity(); // 10
    // The position is not affected by the absolute get() method.
    byte b = bbuf.get(5); // position=0
    // Set the position
    bbuf.position(5);
    // Use the relative get()
    b = bbuf.get();
    // Get the new position
    int pos = bbuf.position(); // 6
    // Get remaining byte count
    int rem = bbuf.remaining(); // 4
    // Set the limit
    bbuf.limit(7); // remaining=1
    // This convenience method sets the position to 0
    bbuf.rewind(); // remaining=7
    Edited by: veewei on May 4, 2010 7:31 PM

  • I'm having trouble with installing a 8g kit in my late 2009 mac mini. when the parts are installed all i get is a beeping sound, is there any way to get around this?

    i'm having trouble with installing a 8g kit in my late 2009 mac mini. when the parts are installed all i get is a beeping sound, is there any way to get around this?

    What is the source & link to this 8 GB kit please?
    Can you count the beeps or flashes?
    1 beep = no RAM installed
    2 beeps = incompatible RAM types
    3 beeps = no good banks
    4 beeps = no good boot images in the boot ROM (and/or bad sys config block)
    5 beeps = processor is not usable
    In addition to the beeps, on some computers the power LED will flash a corresponding number of times plus one. The LED will repeat the sequence after approximately a 5-second pause. The tones are only played once.
    Note: In this case, a flash is considered to be 1/4 second or 250 ms or greater in length.
    http://support.apple.com/kb/HT1547

  • Is there a generic way to get sequence

    Hey,
    I need a counter that will not initialized when my sever restarted, so i decide to write sequence in the data base for this.
    My question is there a generic (for any vendor) way to get next id?
    Thank you

    If all of the target databases supports transactions then it is possible
    1. Create a table that holds sequence number
    2. For each operation
    ....a. Start transaction
    ....b. Get row - only one exists. Hold unto value.
    ....c. Increment value
    ....d. Update row
    ....e. Commit transaction.
    ....f. Return value from step b.
    3. Use index value in some other expression.
    Some databases, with non-ANSI SQL code might allow step 2 to be handled as a single statement, thus no transaction is needed.
    The above allows for sequential values.
    You can find "guid" algorithms written in java. Those produce non-sequential values.
    You can produce your own value that is sequential if you can make assumptions about the enviroment that all of the systems will be running in by combining some or all of the following values.
    - datetime
    - ip
    - process id
    - static counter in application
    - thread id

  • C20/SX20: is there a way to get cdr with loss/jitter stats?

    I try to get a cdr report with loss/jitter, but can not find a solution to do that.
    a) TMS is able to report cdr but only on call participants/duration/encryption/protocol
    b) C20 web gui has the information but only with a count of clicks and only for one call each time
    c) C20 API (cli) I found some commands but nothing to get loss/jitter
        tried xstatus Diagnostics Call Channels -> only for active calls; 
        tried xHistory CallLogs  Recent | Call -> nothing usable
    Is there a way to get cdr with jitter/loss counters for each C20/SX20 in a reporting format?

    Are you at the latest TC 7 software version?    7.2.1 I believe
    Not sure when it was added, but in the Web GUI, under call history...it shows summary info as 1 call per row , then you click the line and it will show detail...   I believe it shows Max Jitter values over the entire call, I find the Diagnostics/Call History easier to read than pulling the call log files

  • Getting count of occurances of a string in a column value

    Hi,
    Is there a way to get the number of occurences of a string in a single column value?
    Example:
    CREATE TABLE STRING_CNT(X VARCHAR2(100));
    INSERT INTO STRING_CNT(X) VALUES('OracleXXOracleXXOracleXXOracle');
    Commit;
    Now the string 'Oracle' is repeated 4 times in the inserted value. I would like to get this count using SQL.Can some one tell me how to get this?
    I was asked this interesting question in an interview today.

    hi<br>
    u can get the occurrence of a string in text as
    follow<br>
    >
    SELECT (LENGTH(x)-LENGTH(REPLACE(x,'Oracle', ' ' )))<br>
    / LENGTH('Oracle') as<br>
    Occurrence FROM STRING_CNT;<br><br>
    <br>
    Are you sure...?<br>
    <br>
    <br>
    SQL> with STRING_CNT as
      2  (select '1.Oracle2.Oracle3.' x
      3  from dual)
      4  SELECT (LENGTH(x)-LENGTH(REPLACE(x,'Oracle', ' ' ))) / LENGTH('Oracle') as Occurrence
      5  FROM STRING_CNT;
    OCCURRENCE
    1.66666667
    <br>
    Sidenote: Please give a try before posting..<br>
    And you are posting a wrong solution after a TESTED right solution posted hours before..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to get "Count" from CAF's Application Service

    hi
    i want know how many data in my entity, i can use "findAll" and read the List's size.
    but it will waste resource.
    have any other way to get the count from entity?

    seem no way.

  • Problem getting Count Of ChildNodes (JAXP)

    I am trying to process an XML Document like
    <Report siteID="1234567">
    <Transaction transactionDetail="VFVF56760482" referenceNumber="32293642" date="09-01-2003 09:30 AM">
    <Item modelNo="" serialNo="" quantity="1" price="250.00" total="250.00" description="Rayban Sun Glasses 1" />
    </Transaction>
    </Report>
    Once i get the Main Node ("Transaction") using
    int nodeLen=0;
    NodeList nList = doc.getElementsByTagName("Transaction");
    nodeLen = nList.getLength();
    for(int i=0; i<nodeLen ;i++){
         Node n = nList.item(i);
         NamedNodeMap nnm = n.getAttributes();
         int attrItems = nnm.getLength();
    //Below is where the problem is..
    System.out.println("ChildNodes:"+ n.getChildNodes().getLength());
    n.getChildNodes.getLength = 3 , there is only one ChildNode for Transaction1 Node.
    Is this a bug in JAXP or am i missing something?
    Appreciate any Help
    Thanks
    Joe Eugene

    n.getChildNodes() includes ignorableWhitespace text
    nodes.
    Refer to
    http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/dom
    2b_display.htmlThanks for your reply...
    Is there a way to get the correct count of ChildNodes?
    Thanks,
    Joe Eugene

Maybe you are looking for

  • Index Vs Primary Key of a table/Internal table

    Hello Friends, What is the difference between Key and Index of a table? What is the difference between creating an index and specifying "Is Unique" to "Yes" vs creating a Unique Key and specifying "Is Unique" to "Yes"? Thanks Simmi

  • Mail for Exchange : HTTP Server Error 500

    Just installed MFE on my Nokia E90 and having issues synching it up with my exchange account. I checked the log and this is what it says : 19/12/2008 9:23:03 Setting OFFLINE Status to False 19/12/2008 9:23:03 Setting ROAMING status to False 19/12/200

  • Gtx860m 2gb serious Problem with gtaV fifa15 MGS ground zero

    Hi people, i have a serious problem with my vga (gtx86m) when i wanna play with gtav,fifa 15 or mgs ground zero and i start msi after burner i notice that my vga usage is 0%.why? i have the last nvidia drivers installed on my notebook(350.12) anyone

  • Plz help i have capturing problem.......

    I'm using SONY HDVCAM(HDD) Capturing with SONY HVR DR60 keeps asking me to render for audio alone...is there any ways which will not ask me for audio render....

  • OVi Suite 2.0 problem - Watching Photos/Music usin...

    Hi, I have a problem trying to create watch folders for my OVI Suite. I'm trying to add watch folders for my photos and music (all which are in an external HDD) and whenever i try and select a folder from my external HDD it won't let me click on 'OK'