Hint to create a huge table

Dear buddies,
I am trying to create a table with a select statement.
The where clause is a bit complicated. And the table is also huge.. Its taking hours but not creating it as of now. Any hint that I could use to speed the select statement?
Please guide me.
Its a select * from ....
Thanks
Nith

user645399 wrote:
Dear buddies,
I am trying to create a table with a select statement.
The where clause is a bit complicated. And the table is also huge.. Its taking hours but not creating it as of now. Any hint that I could use to speed the select statement?
Please guide me.
Its a select * from ....
Thanks
NithThread: HOW TO: Post a SQL statement tuning request - template posting
HOW TO: Post a SQL statement tuning request - template posting

Similar Messages

  • Create Index on a huge table

    Hi,
    We have a huge table and there is no index on this table, I want to create index on this table, we are working on Oracle 11g/Linux.
    Our business users are frequently accessing this table and select statement taking very long time.
    Please let me know which index type would be best suited for this and what would the command to create index on it.
    Would appreciate your assistance.
    Regards.

    >
    We have a huge table and there is no index on this table, I want to create index on this table, we are working on Oracle 11g/Linux.
    Our business users are frequently accessing this table and select statement taking very long time.
    Please let me know which index type would be best suited for this and what would the command to create index on it.
    >
    We need loads of information to suggest anything useful
    a) What database version is yours? (if 11g, you have good more options)
    b) What type of environment is it? OLTP or Warehouse?
    c) How big is the table?
    d) How many distinct values are there in that column that you want to index?
    e) Would this index undergo lots of inserts/deletes/updates? That is, is this table used mainly for querying or will it undergo continous inserts/updates/deletes?
    In case your environment is warehouse type where you load once and then mainly used for queries and more importantly, if that column has very few distinct columns (typical example is a GENDER column where you have only two distinct values), you will be largely benefitted from BITMAP index. If it's an OLTP environment where multiple processes will be inserting into the table, you never ever go near BITMAP index but do only B-Tree index.
    Finally, have you arrived at a concrete reason on why you want to build that index now rather than when you designed the table? If you don't need an index for sure, better not have it. If you are on 11g, you can have INVISIBLE index.
    Also, if it's a very large table, you may create the index nologging to avoid loads of redo generation (not recommended on production environment though). But you have to be aware that in the event of disaster recovery you will have to recreate the index after you restore the database. Also if you are on Dataguard environment, you have to take necessary precautions while doing NOLOGGING operations.
    Edited by: user12035575 on Sep 11, 2011 12:37 PM

  • When analytical queries create implicit temp tables?

    Hi,
    We have a DSS project on Oracle 9i Release 2 running on HP-UX. The project includes lots of SQL Analytical queries which handle huge data set, and makes lots of hash/merge joins and sorts. When I look at execution plans of the queries, I see that some of them create implicit temp tables and execute on it, but some not (creating window(buffer) ). I wonder how the optimizer decides to create implicit temp table when executing analytical queries. And also is three a SQL hint to force to create implicit temp table?
    Regards

    Hi,
    We have a DSS project on Oracle 9i Release 2 running on HP-UX. The project includes lots of SQL Analytical queries which handle huge data set, and makes lots of hash/merge joins and sorts. When I look at execution plans of the queries, I see that some of them create implicit temp tables and execute on it, but some not (creating window(buffer) ). I wonder how the optimizer decides to create implicit temp table when executing analytical queries. And also is three a SQL hint to force to create implicit temp table?
    Regards

  • Update records in huge table

    Hi,
    I need to update two fields in a huge table (> 200.000.000 records). I've created 2 basic update scripts with a where clause. The problem is that there isn't an index on these fields in the where clause. How can I solve this? Creating a new index is not an option.
    An other solution is to update the whole table (so without a where clause) but I don't know if it takes a lot of time, locks records,...
    Any suggestions?
    Thanks.
    Ken

    Ken,
    You may be better off reading the metalink documents. PDML stands for Parallel DML. You can use parallel slaves to get the update done quickly. Obviously this is dependent on the number of parallel slaves you have and the degree you set
    Type PDML on metalink
    G

  • Bitmap index or Composite index better on a huge table

    Hi All,
    I got a question regarding the Bitmap index and Composite Index.
    I got a table which has got only two colums CUSTOMER(group_no NUMBER, order_no NUMBER)
    This is a 100Million+ record table and here I got 100K Group_nos and and unique 100Million order numbers. I.E Each group should have 1000 order numbers.
    I tested by creating a GLOBAL Bitmap index on this huge table(more than 1.5gb in size) and the GLOBAL Bitmap index that got created is under 50MB and when I query for a group number say SELECT * FROM CUSTOMER WHERE group_no=67677; --> 0.5 seconds to retrive all the 1000 rows. I checked for different groups and it is the same.
    Now I dropped the BitMap Index and re-created a Composite index on( group_no and order_no). The index size more than the table size and is around 2GB in size and when I query using the same select statment SELECT * FROM CUSTOMER WHERE group_no=67677; -->0.5 seconds to retrive all the 1000 rows.
    My question is which one is BETTER. BTree or BITMAP Index and WHY?
    Appreciate your valuable inputs on this one.
    Regars,
    Madhu K.

    Dear,
    Hi All,
    I got a question regarding the Bitmap index and Composite Index.
    I got a table which has got only two colums CUSTOMER(group_no NUMBER, order_no NUMBER)
    This is a 100Million+ record table and here I got 100K Group_nos and and unique 100Million order numbers. I.E Each group should have 1000 order numbers.
    I tested by creating a GLOBAL Bitmap index on this huge table(more than 1.5gb in size) and the GLOBAL Bitmap index that got created is under 50MB and when I query for a group number say SELECT * FROM CUSTOMER WHERE group_no=67677; --> 0.5 seconds to retrive all the 1000 rows. I checked for different groups and it is the same.
    Now I dropped the BitMap Index and re-created a Composite index on( group_no and order_no). The index size more than the table size and is around 2GB in size and when I query using the same select statment SELECT * FROM CUSTOMER WHERE group_no=67677; -->0.5 seconds to retrive all the 1000 rows.
    My question is which one is BETTER. BTree or BITMAP Index and WHY?
    Appreciate your valuable inputs on this one.First of all, bitmap indexes are not recommended for write intensive OLTP applications due to the locking threat they can produce in such a kind of applications.
    You told us that this table is never updated; I suppose it is not deleted also.
    Second, bitmap indexes are suitable for columns having low cardinality. The question is how can we define "low cardinality", you said that you have 100,000 distincts group_no on a table of 100,000,000 rows.
    You have a cardinality of 100,000/100,000,000 =0,001. Group_no column might be a good candidate for a bitmap index.
    You said that order_no is unique so you have a very high cardinality on this column and it might not be a candidate for your bitmap index
    Third, your query where clause involves only the group_no column so why are you including both columns when testing the bitmap and the b-tree index?
    Are you designing such a kind of index in order to not visit the table? but in your case the table is made only of those two columns, so why not follow Hermant advise for an Index Organized Table?
    Finally, you can have more details about bitmap indexes in the following richard foot blog article
    http://richardfoote.wordpress.com/2008/02/01/bitmap-indexes-with-many-distinct-column-values-wotsuh-the-deal/
    Best Regards
    Mohamed Houri

  • Deletion from huge table

    hi,
    we need to delete from a huge table (~11 million records) based on a column lookup from another table. Other than general DELETE statement , is there any best way to have fast delete
    thanks.

    SHMYG@rex> create table test (f1 varchar2(10));
    SHMYG@rex> create table test1 (f1 varchar2(10));
    SHMYG@rex> insert into test values ('a');
    SHMYG@rex> insert into test values ('b');
    SHMYG@rex> insert into test1 values ('a');
    SHMYG@rex> select * from test;
    F1
    a
    b
    SHMYG@rex> select * from test1;
    F1
    a
    SHMYG@rex> delete from test where exists (select * from test1 where test.f1 = test1.f1);
    SHMYG@rex> select * from test;
    F1
    b

  • How to create a Z* table which can maintain through SM30?

    How to create a Z* table which can maintain through SM30? Thanks!

    This question had been asked millions of times...you just need to search the forums...
    Quick hint...goto SE11...the utilities menu and then Table Maintenance Generator.
    Greetings,
    Blag.

  • Query for the huge table is not working.

    Hi,
    I am having a link between oracle server and Microsoft sql server let' say 'SQLWEB' this link is perfectly working fine when I query table having few hundred thousand records but It’s not working for one of the table which is having a more then 3 million record at sql server. any one of you is having any Idea why this peculiar behavior is there any limitations for this heterogeneous link is there any workaround for the same. Below you can see the first query returns the count from table but second query is getting disconnected as that’s a very huge table having millions of record.
    shams at oracleserver> select count(*) from investors@sqlweb ;
    COUNT(*)
    15096
    shams at oracleserver> select count(*) from transactions@sqlweb;
    select count(*) from transactions@sqlweb
    ERROR at line 1:
    ORA-02068: following severe error from SQLWEB
    ORA-28511: lost RPC connection to heterogeneous remote agent using SID=%s
    ORA-28509: unable to establish a connection to non-Oracle system
    Regards
    Shamsheer
    Message was edited by:
    Shamsheer

    In general you want to minimize the traffic going over the dblink. This is best handled with view on the sql server try. You might try creating a view on sql server like:
    create view all_investors as
    select * from investors
    Then from sql plus:
    select count from all_investors@sqlweb.

  • Cant Create Globla Temp Table

    Hi,
    I want to create one global temporary table in a package.procedure, i tried to create but it wont created, any reason why?
    I tried in below:-
    create or replace procedure GTT as
    begin
    execute immediate 'create global temporary table Test( SNO number);' ;
    end;
    And table is not created. Is there some thing wrong in the above procedure and please help me to resolve my problem.
    Thanks in Adv.
    Sandeep
    Thanks.

    If you really, really, really need to dynamically create tables, the owner of the procedure would require that the CREATE TABLE privilege be granted directly to the user, not through a role. CREATE ANY TABLE is a far more powerful and dangerous privilege that lets you create objects in other schemas.
    However, and this is a big, huge however, I have never seen a situation where creating a temporary table dynamically in Oracle was a good idea. It almost always indicates someone that doesn't understand how Oracle temporary tables differ from temporary tables in other databases.
    Justin

  • Using hint when creating index

    Hi,
    is it possible to use a hint when creating an index.
    for example normally when creating an index, optimizer does full table scan, but i want it to use a different index to walk through the table.
    any ideas?
    technically impossible?

    If the new index is a subset of an existing index, Oracle should be able to read the existing index to create the new index.
    However, if the index consists of such a combination of columns that one or more is not in the subset then it has to read all the rows of the table.
    Hemant K Chitale

  • Huge Group by operation on Huge Table takes lot of time

    Hi,
    Pl find the below given process which takes of time in execution (approx 5-6 hrs)
    The mailn reason for this is
    1) It Fetch data from huge table partition (i.e 18GB data for per day)
    2)Performs Group by operations
    3)In the where clause Index is not there on destination_number so performs Full Table scan
    I have some idea i.e I need to change the Some Parameter which will make the process faster ,
    Can you please help on this
    create or replace table tmp_kumar nologging as
    SELECT c.series_num , subscriber_id , COUNT(1) cnt , SUM(NVL(total_currency_charge,0))total_currency_charge ,
    TRUNC(disconnect_date) FROM
    (select * from prepcdr.PREPCDR_MAR_P3_10 partition(disconnect_date_11) union all
    select * from prepcdr.PREPCDR_MAR_P3_10 partition(disconnect_date_11_new)) b,
    (SELECT series_num, des, created_dt, LENGTH (series_num) len
    FROM PREPCDR.HSS_SERIES_MAST where home_ind ='Y'
    UNION
    SELECT cimd_number, des, created_dt, LENGTH (cimd_number)
    FROM PREPCDR.HSS_CIMD_MASTER) c
    WHERE b.cdr_call_type = '86'
    AND SUBSTR (b.destination_number, 1, c.len) = c.series_num
    AND c.len = (SELECT MAX(x.len) FROM (SELECT series_num, des, created_dt, LENGTH (series_num) len
    FROM PREPCDR.HSS_SERIES_MAST where home_ind ='Y'
    UNION
    SELECT cimd_number, des, created_dt, LENGTH (cimd_number) len
    FROM PREPCDR.HSS_CIMD_MASTER) x WHERE x.series_num = SUBSTR (b.destination_number, 1, x.len))
    AND disconnect_date >= '11-MAR-2010'
    AND disconnect_date < '12-MAR-2010'
    GROUP BY c.series_num , TRUNC(disconnect_date) , suBscriber_id

    This, most likely, will be more efficient:
    SELECT  c.series_num,
            subscriber_id,
            COUNT(1) cnt,
            SUM(NVL(total_currency_charge,0)) total_currency_charge,
            TRUNC(disconnect_date)
      FROM  (
              select  *
                from  prepcdr.PREPCDR_MAR_P3_10 partition(disconnect_date_11)
             union all
              select  *
                from  prepcdr.PREPCDR_MAR_P3_10 partition(disconnect_date_11_new)
            ) b,
             SELECT  DISTINCT series_num,
                              des,
                              created_dt,
                              len
               FROM  (
                      SELECT  series_num,
                              des,
                              created_dt,
                              len,
                              RANK() OVER(ORDER BY len) rnk
                        FROM  (
                                SELECT  series_num,
                                        des,
                                        created_dt,
                                        LENGTH(series_num) len
                                  FROM  PREPCDR.HSS_SERIES_MAST
                                  where home_ind ='Y'
                               UNION ALL
                                SELECT  cimd_number,
                                        des,
                                        created_dt,
                                        LENGTH(cimd_number)
                                  FROM  PREPCDR.HSS_CIMD_MASTER
               WHERE rnk = 1
            ) c
      WHERE b.cdr_call_type = '86'
        AND SUBSTR(b.destination_number,1,c.len) = c.series_num
       AND disconnect_date >= DATE '2010-03-11'
       AND disconnect_date < DATE '2010-03-12'
      GROUP BY  c.series_num,
                TRUNC(disconnect_date),
                suBscriber_id
    /SY.

  • Accessing huge tables like bseg,  bkpf

    1) What are the precautions we should consider while accessing huge tables like bseg, bkpf or mseg tables.

    Hi,
    Some tips may be:
    1)
    Write the Select statements covering all( or almost all ) the primary keys in the same order as defined in the DB table in the WHERE clause.
    2)
    Incase, if you were using the fields that were not in the Primary key of the DB table, create Secondary indexes on these fields.
    3)
    Always try using an Array fetch of the records on the table instead of going for Select & Endselect....
    Thanks,
    Vishnu.

  • How can I create a new table in a MySQL database in MVC 5

    I have an MVC 5 app, which uses MySQL hosted in Azure as a data source. The point is that inside the database, I want to create a new table called "request". I have already activated migrations for my database in code. I also have the following
    code in my app.
    Request.cs: (inside Models folder)
    public class Request
    public int RequestID { get; set; }
    [Required]
    [Display(Name = "Request type")]
    public string RequestType { get; set; }
    Test.cshtml:
    @model Workfly.Models.Request
    ViewBag.Title = "Test";
    <h2>@ViewBag.Title.</h2>
    <h3>@ViewBag.Message</h3>
    @using (Html.BeginForm("SaveAndShare", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
    @Html.AntiForgeryToken()
    <h4>Create a new request.</h4>
    <hr />
    @Html.ValidationSummary("", new { @class = "text-danger" })
    <div class="form-group">
    @Html.LabelFor(m => m.RequestType, new { @class = "col-md-2 control-label" })
    <div class="col-md-10">
    @Html.TextBoxFor(m => m.RequestType, new { @class = "form-control", @id = "keywords-manual" })
    </div>
    </div>
    <div class="form-group">
    <div class="col-md-offset-2 col-md-10">
    <input type="submit" class="btn btn-default" value="Submit!" />
    </div>
    </div>
    @section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    HomeController.cs:
    [HttpPost]
    public ActionResult SaveAndShare(Request request)
    if (ModelState.IsValid)
    var req = new Request { RequestType = request.RequestType };
    return RedirectToAction("Share");
    The point is that, I want the user to fill the form inside the Test view and click submit, and when the submit is clicked, I want a new entry in the new table to be created. But first of course I need to create the table. Should I create it using SQL query
    through MySQL workbench? If yes, then how can I connect the new table with my code? I guess I need some DB context but don't know how to do it. If someone can post some code example, I would be glad.
    UPDATE:
    I created a new class inside the Models folder and named it RequestContext.cs, and its contents can be found below:
    public class RequestContext : DbContext
    public DbSet<Request> Requests { get; set; }
    Then, I did "Add-Migration Request", and "Update-Database" commands, but still nothing. Please also note that I have a MySqlInitializer class, which looks something like this:
    public class MySqlInitializer : IDatabaseInitializer<ApplicationDbContext>
    public void InitializeDatabase(ApplicationDbContext context)
    if (!context.Database.Exists())
    // if database did not exist before - create it
    context.Database.Create();
    else
    // query to check if MigrationHistory table is present in the database
    var migrationHistoryTableExists = ((IObjectContextAdapter)context).ObjectContext.ExecuteStoreQuery<int>(
    string.Format(
    "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{0}' AND table_name = '__MigrationHistory'",
    // if MigrationHistory table is not there (which is the case first time we run) - create it
    if (migrationHistoryTableExists.FirstOrDefault() == 0)
    context.Database.Delete();
    context.Database.Create();

    Hello Toni,
    Thanks for posting here.
    Please refer the below mentioned links:
    http://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/
    http://social.msdn.microsoft.com/Forums/en-US/3a3584c4-f45f-4b00-b676-8d2e0f476026/tutorial-problem-deploy-a-secure-aspnet-mvc-5-app-with-membership-oauth-and-sql-database-to-a?forum=windowsazurewebsitespreview
    I hope that helps.
    Best Regards,
    Sadiqh Ahmed

  • Error while creating the DWH tables using DAC

    Hi,
    I am getting error while creating the DWH tables using DAC. I have created a ODBC DSN using merant driver with DAC repository DB credentials and the test connection is successful. And while creating the tables i gave the olap dw credentials and the DSN name which i created earlier. But it throws the error as below:
    Please find the below mentioned error message
    =====================================
    STD OUTPUT
    =====================================
    CREATING SIEBEL DATABASE OBJECTS
    F:\DAC\bifoundation\dac\UTILITIES\BIN\DDLIMP /I N /s N /u infdomain /p ******* /c DB_DAC /G "SSE_ROLE" /f F:\DAC\bifoundation\dac/conf/sqlgen/ctl-file/oracle_bi_dw.ctl /b "" /K "" /X "" /W N
    Error while importing Siebel database schema.
    =====================================
    ERROR OUTPUT
    =====================================
    Siebel Enterprise Applications ODBC DDL Import Utility, Version 7.7 [18030] ENU
    Copyright (c) 2001 Siebel Systems, Inc. All rights reserved.
    This software is the property of Siebel Systems, Inc., 2207 Bridgepointe Parkway,
    San Mateo, CA 94404.
    User agrees that any use of this software is governed by: (1) the applicable
    user limitations and other terms and conditions of the license agreement which
    has been entered into with Siebel Systems or its authorized distributors; and
    (2) the proprietary and restricted rights notices included in this software.
    WARNING: THIS COMPUTER PROGRAM IS PROTECTED BY U.S. AND INTERNATIONAL LAW.
    UNAUTHORIZED REPRODUCTION, DISTRIBUTION OR USE OF THIS PROGRAM, OR ANY PORTION
    OF IT, MAY RESULT IN SEVERE CIVIL AND CRIMINAL PENALTIES, AND WILL BE
    PROSECUTED TO THE MAXIMUM EXTENT POSSIBLE UNDER THE LAW.
    If you have received this software in error, please notify Siebel Systems
    immediately at (650) 295-5000.
    F:\DAC\bifoundation\dac\UTILITIES\BIN\DDLIMP /I N /s N /u infdomain /p ***** /c DB_DAC /G SSE_ROLE /f F:\DAC\bifoundation\dac/conf/sqlgen/ctl-file/oracle_bi_dw.ctl /b /K /X /W N
    Connecting to the database...
    28000: [DataDirect][ODBC Oracle driver][Oracle]ORA-01017: invalid username/password; logon denied
    Unable to connect to the database...
    any help is appreciated.
    Thanks,
    RM

    The fact that you are getting an "ORA-01017: invalid username/password; logon denied" message indicates that you are at least talking to the database.
    The log shows that username "infdomain" is being used. Can you double check the username and password you have in DAC in a SQL*Plus/SQL Developer session?
    Please mark if useful/helpful,
    Andy.

  • Error while creating Cross-reference table using Xreftool (PIP Ins)

    Error while running xref.sh script unable to create cross reference table.
    **Error: Exception in thread "main" java.lang.NoClassDefFoundError: oracle/tip/xref/tool/AdminTool**
    Could not find xref directory within tip folder (/OracleAS_1/bpel/docs/workflow/oracle/tip)
    searched for similar issue in OTN it says issue fixed by upgrading Oracle AS, we are using 10.1.3.4 MLR#8
    http://kr.forums.oracle.com/forums/thread.jspa?threadID=835446
    steps followed.
    Creating Cross-Reference Tables
    Complete the following procedure to create cross-reference tables.
    To create cross-reference tables
    1 Navigate to the following directory:
    %SOAHOME%/SiebelODOPPIP/scripts/
    2 Open the following file for editing:
    xref.sh
    3 Set the userid and passwd for logging into BPEL console on the appropriate lines.
    4 Set the correct SOA_HOME location on the appropriate line.
    5 Save and close the file.
    6 Make the file executeable:
    chmod +x xref.sh
    dos2unix xref.sh
    7 Change directory (cd) to integration/esb/bin under %SOAHOME%.
    8 Execute ../../../SiebelODOPPIP/scripts/xref.sh.
    I am using SOA suite 10.1.3.3 and getting same error
    Error: Exception in thread "main" java.lang.NoClassDefFoundError: oracle/tip/xref/tool/AdminTool

    Hi Abhijeet,
    please check in transaction FI01, about your data consistencies. You can use this wiki help in terms of Address, it it found any useful facts for you
    Address Checks - Business Address Services (BC-SRV-ADR) - SAP Library

Maybe you are looking for

  • What will I lose by removing a folder and then resynchronizing?

    I am having a problem editing files that I imported into Lightroom from my photoshop elements 6 catalog. The details of what I've gone through are in the thread titled: Problem with "Edit in Photoshop" and Lightroom 2.1 failing to import new file I t

  • Can we assign jython variable value into ODI variable?

    Hi Team, We are trying to save jython variable value into ODI variable so that ODI variable can use in later steps. we are facing failure regards same. Please suggest us so that we can use ODI variable value in later steps. Thanks Ankush.

  • Ipod battery issues

    My ipod only charges half way after 8 hours of charging. I've only had it for 2 months. Does it need a new battery?

  • Safari closing unexpectedly ios 7

    I upgraded a 4s to iOS 7 - when I go to some web pages I am consistently kicked out of Safari. Same thing happened using Chrome for iOS. Here is an example page - search Google for "best iPhone 5s cases"and go to the new pcmag article - it will load

  • "reference count underflow" printing NSDocument using "Save as PDF"

    Hello, I'm getting a "reference count underflow" error trying to do a "Save as PDF" in a NSDocument class using the printOperationWithSettings method. There are no errors sending to the printer or viewing the output in preview. I found the post http: