Create table query taking too long..

Hello experts...
I am taking the backup of table A which consist of 135 million records...
for this am using below query..
create table tableA_bkup as select * from tableA;
it is taking more than hour..still running....
is there any other way to query fast....
thanks in advance....

CTAS is one of the fastest ways to do such a thing.
Remember you duplicate data. THis means if your table holds 50GB of data then it will have to copy those 50GB of data.
A different way could be to use EXPDP to create a backup dump file from this table data. However I'm not sure if there is a big performance difference.
Both versions could profit from parallel execution.

Similar Messages

  • Query taking too long

    I am running a fairly complex query with several table joins
    and it is taking too long. What can I do to improve performance?
    Thanks.
    Frank

    Dan's first suggestion is key - if you are doing multiple
    table joins, you want to make sure your indexes are set up on your
    tables correctly. If you have access to the database, this should
    be your first step. Rationalize's stored procedure suggestion is
    also a great idea (again, if you have access to create and manage
    stored procedures on your DB).
    Other than than, most databases usually have some sort of SQL
    efficiency analysis tool. SQL server has one built into their Query
    Analyzer tool. I would recommend using something like that to
    streamline your SQL. Like Dan said, something as simple as the
    order of elements in your where clause might make a big
    difference.

  • Query taking too long a time

    Hi friends,
    the view I have created on a table is taking toooo long a time to gimme the results
    when am trying to select * from table_name
    Can some one suggest me a solution pls
    CREATE OR REPLACE VIEW XXKDD_LATEST_SAL
    (RN, MONTH, YEAR, EMPLOYEE_NUMBER, POSITION,
    PAYROLL_NAME, DEPT, STATUS, TERMINATION_DATE, FULL_NAME,
    TOP3, BASIC_SALARY)
    AS
    select "RN","MONTH","YEAR","EMPLOYEE_NUMBER","POSITION","PAYROLL_NAME","DEPT","STATUS","TERMINATION_DATE","FULL_NAME","TOP3","BASIC_SALARY" from (
    SELECT ROW_NUMBER() OVER (PARTITION BY employee_number ORDER BY employee_number) rn, tp.*
    FROM (SELECT MONTH, YEAR, employee_number, position, payroll_name, dept, status, termination_date, full_name,
    ROW_NUMBER () OVER (PARTITION BY employee_number, basic_salary ORDER BY YEAR , MONTH) top3,
    DECODE (basic_salary,
    100000, 4500,
    24000, 1921,
    basic_salary
    ) basic_salary
    FROM kdd_pay_hr_sal_vw
    order by employee_number,year desc) tp
    WHERE top3 <= 1
    select * from XXKDD_LATEST_SAL

    Read these informative threads:
    When your query takes too long ...
    HOW TO: Post a SQL statement tuning request - template posting
    And edit your post, add relevant details like database version, execution plan etc., it is all listed in the above links.
    And use the {noformat}{noformat}-tags, to keep your examples formatted and indented and readable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Query taking too long, yet cost is low

    hi guys,
    I am running a query on two databases that were created the same way and have the same data.
    On one the cost is nearly a million, and it runs in a matter of a few seconds
    On the other, the cost is 40000, and it doesn't finish executing
    I have looked at the explain plan, and there is no cartesian merge join on the second query, yet it is taking so long. What can I do to investigate this?
    thanks

    Could you please post an properly formatted explain plan output using DBMS_XPLAN.DISPLAY including the "Predicate Information" section below the plan to provide more details regarding your statement. Please use the \[code\] and \[code\] tags to enhance readability of the output provided:
    In SQL*Plus:
    SET LINESIZE 130
    EXPLAIN PLAN FOR <your statement>;
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);Note that the package DBMS_XPLAN.DISPLAY is only available from 9i on.
    In previous versions you could run the following in SQL*Plus (on the server) instead:
    @?/rdbms/admin/utlxplsA different approach in SQL*Plus:
    SET AUTOTRACE ON EXPLAIN
    <run your statement>;will also show the execution plan.
    In order to get a better understanding where your statement spends the time you might want to turn on SQL trace as described here:
    [When your query takes too long|http://forums.oracle.com/forums/thread.jspa?threadID=501834]
    and post the "tkprof" output here, too.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Query taking too long on Oracle9i

    Hi All
    I am running a query on our prod database (Oracle8i 8.1.7.4) and again running the same query on Test db (Oracle9i version 4). The query is taking too long(more then 10 min) in test db. Both the database are installed on the same machine IBM AIX V4 and table schema and data are same.
    Any help would be appreciated.
    Here are the results.
    FASTER ONE
    ORACLE 8i using Production
    Statistics
    864 recursive calls
    68 db block gets
    159855 consistent gets
    20297 physical reads
    0 redo size
    1310148 bytes sent via SQL*Net to client
    68552 bytes received via SQL*Net from client
    1036 SQL*Net roundtrips to/from client
    28 sorts (memory)
    1 sorts (disk)
    15525 rows processed
    SLOWER ONE
    ORACLE 9i using Test
    Statistics
    819 recursive calls
    80 db block gets
    22981568 consistent gets
    1361 physical reads
    0 redo size
    1194902 bytes sent via SQL*Net to client
    34193 bytes received via SQL*Net from client
    945 SQL*Net roundtrips to/from client
    0 sorts (memory)
    1 sorts (disk)
    14157 rows processed

    319404-
    To help us better understand the problem,
    1) Could you post your execution plan on the two different databases?
    2) Could you list indexes (if any, on these tables)?
    3) Are any of the objects in the 'from list' a view?
    If so, are you using a user defined function to create the view?
    4) Why are you using the table 'cal_instance_relationship' twice in the 'from ' clause'?
    5) Can't your query be the following?
    SELECT f.person_id, f.course_cd, cv.responsible_org_unit_cd cowner, f.fee_cal_type Sem, f.fee_ci_sequence_number seq_no,
    sua.unit_cd, uv.owner_org_unit_cd uowner, uv.supervised_contact_hours hours, 0 chg_rate, sum(f.transaction_amount) tot_fee,
    ' ' tally
    FROM unit_version uv,
    cal_instance_relationship cir1,
    chg_method_apportion cma,
    student_unit_attempt sua,
    course_version cv,
    fee_ass f
    WHERE f.fee_type = 'VET-MATFEE'
    AND f.logical_delete_dt IS NULL
    AND f.s_transaction_type IN ('ASSESSMENT', 'MANUAL ADJ')
    AND f.fee_ci_sequence_number > 400
    AND f.course_cd = cv.course_cd
    AND cv.version_number = (SELECT MAX(v.version_number) FROM course_version v
    WHERE v.course_cd = cv.course_cd)
    AND f.person_id = sua.person_id
    and f.course_cd = sua.course_cd
    AND f.fee_type = cma.fee_type
    AND f.fee_ci_sequence_number = cma.fee_ci_sequence_number
    AND cma.load_ci_sequence_number = cir1.sub_ci_sequence_number
    AND cir1.sup_cal_type = 'ACAD-YR'
    AND cir1.sub_cal_type = sua.cal_type
    AND cir1.sub_ci_sequence_number = sua.ci_sequence_number
    AND sua.unit_attempt_status NOT IN ('DUPLICATE','DISCONTIN')
    AND sua.unit_cd = uv.unit_cd
    AND sua.version_number = uv.version_number
    GROUP BY f.person_id, f.course_cd, cv.responsible_org_unit_cd , f.fee_cal_type, f.fee_ci_sequence_number,
    sua.unit_cd, uv.owner_org_unit_cd, uv.supervised_contact_hours;

  • Loop with WMI Query taking too long, need to break out if time exceeds 5 min

    I've written a script that will loop through a list of computers and run a WMI query using the Win32_Product class. I am pinging the host first to ensure its online which eliminates wasting time but the issue I'm facing is that some of the machines
    are online but the WMI Query takes too long and holds up the script. I wanted to add a timeout to the WMI query so if a particular host will not respond to the query or gets stuck the loop will break out an go to the next computer object. I've added my code
    below:
    $Computers = @()
    $computers += "BES10-BH"
    $computers += "AUTSUP-VSUS"
    $computers += "AppClus06-BH"
    $computers += "Aut01-BH"
    $computers += "AutLH-VSUS"
    $computers += "AW-MGMT01-VSUS"
    $computers += "BAMBOOAGT-VSUS"
    ## Loop through all computer objects found in $Computes Array
    $JavaInfo = @()
    FOREACH($Client in $Computers)
    ## Gather WMI installed Software info from each client queried
    Clear-Host
    Write-Host "Querying: $Client" -foregroundcolor "yellow"
    $HostCount++
    $Online = (test-connection -ComputerName ADRAP-VSUS -Count 1 -Quiet)
    IF($Online -eq "True")
    $ColItem = Get-WmiObject -Class Win32_Product -ComputerName $Client -ErrorAction SilentlyContinue | `
    Where {(($_.name -match "Java") -and (!($_.name -match "Auto|Visual")))} | `
    Select-Object Name,Version
    FOREACH($Item in $ColItem)
    ## Write Host Name as variable
    $HostNm = ($Client).ToUpper()
    ## Query Named Version of Java, if Java is not installed fill variable as "No Java Installed
    $JavaVerName = $Item.name
    IF([string]::IsNullOrEmpty($JavaVerName))
    {$JavaVerName = "No Installed"}
    ## Query Version of Java, if Java is not installed fill variable as "No Java Installed
    $JavaVer = $Item.Version
    IF([string]::IsNullOrEmpty($JavaVer))
    {$JavaVer = "Not Installed"}
    ## Create new object to organize Host,JavaName & Version
    $JavaProp = New-Object -TypeName PSObject -Property @{
    "HostName" = $HostNm
    "JavaVerName" = $JavaVerName
    "JavaVer" = $JavaVer
    ## Add new object data "JavaProp" from loop into array "JavaInfo"
    $JavaInfo += $JavaProp
    Else
    {Write-Host "$Client didn't respond, Skipping..." -foregroundcolor "Red"}

    Let me give you a bigger picture of the script. I've included the emailed table the script produces and the actual script. While running the script certain hosts get hung up when running the WMI query which causes the script to never complete. From one of
    the posts I was able to use the Get-WmiCustom function to add a timeout 0f 15 seconds and then the script will continue if it is stuck. The problem is when a host is skipped I am not aware of it because my script is not reporting the server that timed out.
    If you look at ZLBH02-VSUS highlighted in the report you can see that its reporting not installed when it should say something to the effect query hung.
    How can I add a variable in the function that will be available outside the function that I can key off of to differentiate between a host that does not have the software installed and one that failed to query?
    Script Output:
    Script:
    ## Name: JavaReportWMI.ps1 ##
    ## Requires: Power Shell 2.0 ##
    ## Created: January 06, 2015 ##
    <##> $Version = "Script Version: 1.0" <##>
    <##> $LastUpdate = "Updated: January 06, 2015" <##>
    ## Configure Compliant Java Versions Below ##
    <##> $java6 = "6.0.430" <##>
    <##> $javaSEDEVKit6 = "1.6.0.430" <##>
    <##> $java7 = "7.0.710" <##>
    <##> $javaSEDEVKit7 = "1.7.0.710" <##>
    <##> $java8 = "8.0.250" <##>
    <##> $javaSEDDEVKit8 = "1.8.0.250" <##>
    ## Import Active Directory Module
    Import-Module ActiveDirectory
    $Timeout = "False"
    Function Get-WmiCustom([string]$computername,[string]$namespace,[string]$class,[int]$timeout=15)
    $ConnectionOptions = new-object System.Management.ConnectionOptions
    $EnumerationOptions = new-object System.Management.EnumerationOptions
    $timeoutseconds = new-timespan -seconds $timeout
    $EnumerationOptions.set_timeout($timeoutseconds)
    $assembledpath = "\\" + $computername + "\" + $namespace
    #write-host $assembledpath -foregroundcolor yellow
    $Scope = new-object System.Management.ManagementScope $assembledpath, $ConnectionOptions
    $Scope.Connect()
    $querystring = "SELECT * FROM " + $class
    #write-host $querystring
    $query = new-object System.Management.ObjectQuery $querystring
    $searcher = new-object System.Management.ManagementObjectSearcher
    $searcher.set_options($EnumerationOptions)
    $searcher.Query = $querystring
    $searcher.Scope = $Scope
    trap { $_ } $result = $searcher.get()
    return $result
    ## Log time for duration clock
    $Start = Get-Date
    $StartTime = "StartTime: " + $Start.ToShortTimeString()
    ## Environmental Variables
    $QueryMode = $Args #parameter for either "Desktops" / "Servers"
    $CsvPath = "C:\Scripts\JavaReport\JavaReport" + "$QueryMode" + ".csv"
    $Date = Get-Date
    $Domain = $env:UserDomain
    $HostName = ($env:ComputerName).ToLower()
    ## Regional Settings
    ## Used for testing
    IF ($Domain -eq "abc") {$Region = "US"; $SMTPDomain = "abc.com"; `
    $ToAddress = "[email protected]"; `
    $ReplyDomain = "abc.com"; $smtpServer = "relay.abc.com"}
    ## Control Variables
    $FromAddress = "JavaReport@$Hostname.na.$SMTPDomain"
    $EmailSubject = "Java Report - $Region"
    $computers = @()
    $computers += "ZLBH02-VSUS"
    $computers += "AUTSUP-VSUS"
    $computers += "AppClus06-BH"
    $computers += "Aut01-BH"
    $computers += "AutLH-VSUS"
    $computers += "AW-MGMT01-VSUS"
    $computers += "BAMBOOAGT-VSUS"
    #>
    ## Loop through all computer objects found in $Computes Array
    $JavaInfo = @()
    FOREACH($Client in $Computers)
    ## Gather WMI installed Software info from each client queried
    Clear-Host
    Write-Host "Querying: $Client" -foregroundcolor "yellow"
    $HostCount++
    $Online = (test-connection -ComputerName ADRAP-VSUS -Count 1 -Quiet)
    IF($Online -eq "True")
    $ColItem = Get-WmiCustom -Class Win32_Product -Namespace "root\cimv2" -ComputerName $Client -ErrorAction SilentlyContinue | `
    Where {(($_.name -match "Java") -and (!($_.name -match "Auto|Visual")))} | `
    Select-Object Name,Version
    FOREACH($Item in $ColItem)
    ## Write Host Name as variable
    $HostNm = ($Client).ToUpper()
    ## Query Named Version of Java, if Java is not installed fill variable as "No Java Installed
    $JavaVerName = $Item.name
    IF([string]::IsNullOrEmpty($JavaVerName))
    {$JavaVerName = "No Installed"}
    ## Query Version of Java, if Java is not installed fill variable as "No Java Installed
    $JavaVer = $Item.Version
    IF([string]::IsNullOrEmpty($JavaVer))
    {$JavaVer = "Not Installed"}
    ## Create new object to organize Host,JavaName & Version
    $JavaProp = New-Object -TypeName PSObject -Property @{
    "HostName" = $HostNm
    "JavaVerName" = $JavaVerName
    "JavaVer" = $JavaVer
    ## Add new object data "JavaProp" from loop into array "JavaInfo"
    $JavaInfo += $JavaProp
    Else
    {Write-Host "$Client didn't respond, Skipping..." -foregroundcolor "Red"}
    #Write-Host "Host Query Count: $LoopCount" -foregroundcolor "yellow"
    ## Sort Array
    Write-Host "Starting Array" -foregroundcolor "yellow"
    $JavaInfoSorted = $JavaInfo | Sort-object HostName
    Write-Host "Starting Export CSV" -foregroundcolor "yellow"
    ## Export CSV file
    $JavaInfoSorted | export-csv -NoType $CsvPath -Force
    $Att = new-object Net.Mail.Attachment($CsvPath)
    Write-Host "Building Table Header" -foregroundcolor "yellow"
    ## Table Header
    $list = "<table border=1><font size=1.5 face=verdana color=black>"
    $list += "<tr><th><b>Host Name</b></th><th><b>Java Ver Name</b></th><th><b>Ver Number</b></th></tr>"
    Write-Host "Building HTML Table" -foregroundcolor "yellow"
    FOREACH($Item in $JavaInfoSorted)
    Write-Host "$UniqueHost" -foregroundcolor "Yellow"
    ## Alternate Table Shading between Green and White
    IF($LoopCount++ % 2 -eq 0)
    {$BK = "bgcolor='E5F5D7'"}
    ELSE
    {$BK = "bgcolor='FFFFFF'"}
    ## Set Variables
    $JVer = $Item.JavaVer
    $Jname = $Item.JavaVerName
    ## Change Non-Compliant Java Versions to red in table
    IF((($jVer -like "6.0*") -and (!($jVer -match $java6))) -or `
    (($jName -like "*Java(TM) SE Development Kit 6*") -and (!($jName -match $javaSEDEVKit6))) -or `
    (($jVer -like "7.0*") -and (!($jVer -match $java7))) -or `
    (($jName -like "*Java SE Development Kit 7*") -and (!($jName -match $javaSEDEVKit7))))
    $list += "<tr $BK style='color: #ff0000'>"
    ## Compliant Java version are displayed in black
    ELSE
    $list += "<tr $BK style='color: #000000'>"
    ## Populate table with host name variable
    $list += "<td>" + $Item."HostName" + "</td>"
    ## Populate table with Java Version Name variable
    $list += "<td>" + $Item."JavaVerName" + "</td>"
    ## Populate table with Java Versionvariable
    $list += "<td>" + $Item."JavaVer" + "</td>"
    $list += "</tr>"
    $list += "</table></font>"
    $End = Get-Date
    $EndTime = "EndTime: " + $End.ToShortTimeString()
    #$TimeDiff = New-TimeSpan -Start $StartTime -End $EndTime
    $StartTime
    $EndTime
    $TimeDiff
    Write-Host "Total Hosts:$HostCount"
    ## Email Function
    Function SendEmail
    $msg = new-object Net.Mail.MailMessage
    $smtp = new-object Net.Mail.SmtpClient($smtpServer)
    $msg.From = ($FromAddress)
    $msg.ReplyTo =($ToAddress)
    $msg.To.Add($ToAddress)
    #$msg.BCC.Add($BCCAddress)
    $msg.Attachments.Add($Att)
    $msg.Subject = ($EmailSubject)
    $msg.Body = $Body
    $msg.IsBodyHTML = $true
    $smtp.Send($msg)
    $msg.Dispose()
    ## Email Body
    $Body = $Body + @"
    <html><body><font face="verdana" size="2.5" color="black">
    <p><b>Java Report - $Region</b></p>
    <p>$list</p>
    </html></body></font>
    <html><body><font face="verdana" size="1.0" color="red">
    <p><b> Note: Items in red do not have the latest version of Java installed. Please open a ticket to have an engineer address the issue.</b></p>
    </html></body></font>
    <html><body><font face="verdana" size="2.5" color="black">
    <p>
    $StartTime<br>
    $EndTime<br>
    $TimeDiff<br>
    $HostCount<br>
    </p>
    <p>
    Run date: $Date<br>
    $Version<br>
    $LastUpdate<br>
    </p>
    </html></body></font>
    ## Send Email
    SendEmail

  • Oracle - Query taking too long (Materialized view)

    Hi,
    I am extracting billing informaiton and storing in 3 different tables... in order to show total billing (80 to 90 columns, 1 million rows per month), I've used a materialized view... I do not have indexes on 3 billing tables - do have 3 indexes on Materialized view...
    at the moment it's taking too long to query the data (running a query via toad fails and shows "Out of Memory" error message; runing a query via APEX though is providing results but taking way too long)...
    Please advice how to make the query efficient...

    tparvaiz,
    Is it possible when building your materialized view to summarize and consolidate the data?
    Out of a million rows, what would your typical user do with that amount data if they could retrieve it readily? The answer to this question may indicate if and how to summarize the data within the materialized view.
    Jeff
    Edited by: jwellsnh on Mar 25, 2010 7:02 AM

  • Query taking too long to finish

    Hi,
    I'm running a query which is
    Delete from msg where ID IN (select ID from deletedtrans );
    It's taking too long to complete, it has been running for 24 hours already and not completed executing the query, I cancelled the query. I don't understand why it's taking too long, does anyone have any idea? I feel that this query should not take too long to complete

    That seems to be too small piece of information to comment anything.
    1. How many records are there in "deletedtrans" table ?
    2. How many records from "msg" table are expected to be deleted ?
    3. Are statistics up-to-date on "msg" and "deletedtrans" tables ?
    4. Is "ID" column defined as NULL or NOT NULL in both "msg" and "deletedtrans" tables ? (Not sure whether this will cause any problem, but...)
    5. Is this statement being executed when other users/applications are accessing/updating "msg" table ?

  • Export to xls from table is taking too long (Around 20 min)

    Hi all,
    I am new member to this forum. I had a table with 80 columns and 20000 records. It is having primary key column. When i try to export the table data in toad from data grid it is taking 15-20 min. When i try to export from my front end java application it is saying time out. when i query the table i am getting results in 3 secs, but when tried to export it is taking more time.
    Can any one please provide me solution for exporting the data faster with in a min?
    My table structure is
    COL1     NUMBER
    COL2      VARCHAR2 (150 Byte)
    COL3     DATE
    COL4      DATE
    COL5      NUMBER
    COL6      NUMBER
    COL7      VARCHAR2 (6 Byte)
    COL8      NUMBER
    COL9      NUMBER
    COL10     NUMBER
    COL11     NUMBER
    COL12     NUMBER
    COL13     NUMBER
    COL14     NUMBER
    COL15     CHAR (1 Byte)
    COL16     CHAR (1 Byte)
    COL17     NUMBER
    COL18     NUMBER
    COL19     NUMBER
    COL20     NUMBER
    COL21     NUMBER
    COL22     NUMBER
    COL23     VARCHAR2 (200 Byte)
    COL24     VARCHAR2 (200 Byte)
    COL25     VARCHAR2 (200 Byte)
    COL26     VARCHAR2 (200 Byte)
    COL27     VARCHAR2 (200 Byte)
    COL28     VARCHAR2 (200 Byte)
    COL29     NUMBER
    COL30     VARCHAR2 (200 Byte)
    COL31     NUMBER
    COL32     NUMBER
    COL33     NUMBER
    COL34     NUMBER
    COL35     NUMBER
    COL36     NUMBER
    COL37     NUMBER
    COL38     NUMBER
    COL39     NUMBER
    COL40     NUMBER
    COL41     DATE
    COL42     VARCHAR2 (150 Byte)
    COL43     DATE
    COL44     VARCHAR2 (150 Byte)
    COL45     NUMBER
    COL46     VARCHAR2 (50 Byte)
    COL47     VARCHAR2 (50 Byte)
    COL48     NUMBER
    COL49     NUMBER
    COL50     CHAR (1 Byte)
    COL51     CHAR (1 Byte)
    COL52     VARCHAR2 (150 Byte)
    COL53     CHAR (1 Byte)
    COL54     VARCHAR2 (150 Byte)
    COL55     NUMBER
    COL56     NUMBER
    COL57     VARCHAR2 (250 Byte)
    COL58     CHAR (1 Byte)
    COL59     CHAR (1 Byte)
    COL60     CHAR (1 Byte)
    COL61     CHAR (1 Byte)
    COL62     CHAR (1 Byte)
    COL63     CHAR (1 Byte)
    COL64     CHAR (1 Byte)
    COL65     CHAR (1 Byte)
    COL66     CHAR (1 Byte)
    COL67     CHAR (1 Byte)
    COL68     CHAR (1 Byte)
    COL69     CHAR (1 Byte)
    COL70     CHAR (1 Byte)
    COL71     CHAR (1 Byte)
    COL72     NUMBER
    COL73     NUMBER
    COL74     NUMBER
    COL75     NUMBER
    COL76     NUMBER
    COL77     CHAR (1 Byte)
    COL78     CHAR (1 Byte)
    COL79     CHAR (1 Byte)

    Hi,
    I got it. But this export is happening from front end java application, Which i am simulating in back-end toad. Could you please help me any architecture level approach while creating table. Once again thanks for your input.
    Regards,
    Pavan.

  • Query taking too long to execute

    Hi All,
    I have just moved a cube from DEV to Q and loaded the data(using INIT). I have created a query to test the data. When I execute the query, the initial result is showing up quickly but when I drill down using one char, say CHAR ABC, it is taking a lot time(I am waiting from last 25 min to see the result but it is still running). The same query is not taking any time when run in T. What could be the problem. This query is my first query in Q.
    Any suggestions would be highly appreciated.
    Best Rgds,
    James.

    GO to RSRV and you will see a an option " All combined tests.
    IN that, you will see " Check data for master data". Double click that and enter your CHAR* and run the test.
    Next under transaction data " run each of the tests" for the ODS / Cube that you run the report from.
    These tests usually will point to inconsistency. You may also want to look the design of cube / ODS. In ODS, you may have to check the key fields.
    Ravi Thothadri

  • Partition Table Query taking Too Much Time

    I have created partition table and Created local partition index on a column whose datatype is DATE.
    Now when I Query table and use index column in the where clause It is scaning all the table (Full scan) . The quey is :
    Select * From mytable
    where to_char(transaction_date, 'DD-MON-YY') = '01-Aug-07';
    I have to use to_char function not to_date due to Front end application problem.

    Before we go too far with this, if you manually query with TO_DATE on the variable instead of TO_CHAR on the column, does the query actually use the index?
    The TO_CHAR on the column will definitely stop Oracle from using any index on the column. If the query will use the index if you TO_DATE the variable, as I see it, you have three options. First, fix the application problem that won't let you use TO_DATE from the application. Second, change the application to call a function returning a ref cursor, get the date string as a parameter to the function, and do the TO_DATE in the function.
    Third, you could consider creating a function-based index on TO_CHAR(transaction_date, 'dd-Mon-yy'). This would be the least desirable option, particularly if you would also be selecting records based on a range of transaction_dates, since it loses a lot of information that the optimizer could use in devising an efficient query plan. It could also change your results for a range scan.
    John

  • Sql query taking too long to run

    I am not sure what to do. My app takes two long to run and the reason is right in front of me, but again, I don't know what to do or where to go. (VB.Net VS 2005)
    The main part of my query takes about 15 to 20 seconds to run. When I tack on this other part it slows the response to over 2 minutes.
    Even running this other part alone takes 2+ minutes. The query as two sum functions. Is it possible, some how, that this query can run building it's results into another table and then I use this new table with the results all ready to go and join into the first part of the main query?
    I am using oracle 9i with a Sql Developer. Which I am new to. Below is the culprit: Thanks
    Select adorder.primaryorderer_client_id,
    (sum(Case When insertion.insert_date_id >= 2648 and insertion.insert_date_id < 2683
    Then insertchargedetail.Amount_insertDetail Else 0 End)) As CurRev,
    (sum(Case When insertion.insert_date_id >= 2282 and insertion.insert_date_id < 2317
    Then insertchargedetail.Amount_insertDetail Else 0 End)) As LastRev
    from Adorder
    Inner Join insertion On Adorder.id=insertion.Adorder_id
    Inner Join insertchargesummary On insertion.id=insertchargesummary.insertion_id
    Inner Join insertchargedetail On insertchargesummary.id=insertchargedetail.insertchargesummary_id
    where ((insertion.insert_date_id >= 2282 and insertion.insert_date_id < 2317)
    Or (insertion.insert_date_id >= 2648 and insertion.insert_date_id < 2683))
    group by adorder.primaryorderer_client_id;

    How to post a tuning request:
    HOW TO: Post a SQL statement tuning request - template posting

  • SQL Query taking too long

    Hello there,
    Can someone please help me:
    I have this SQL query that is taking days to complete, and they say when it runs on the former DB version 8 it used to run for 1 hour but now we're using 10g ... it's taking days ... any help with that please?
    Texas

    Texas B wrote:
    | Id  | Operation                     | Name             | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT              |                  |     1 |   119 |  3171   (2)| 00:00:39 |
    |   1 |  NESTED LOOPS                 |                  |     1 |   119 |  3171   (2)| 00:00:39 |
    |   2 |   MERGE JOIN CARTESIAN        |                  |     1 |    71 |  3097   (2)| 00:00:38 |
    |*  3 |    TABLE ACCESS BY INDEX ROWID| PS_JRNL_LN       |     1 |    41 |   388   (0)| 00:00:05 |
    |*  4 |     INDEX SKIP SCAN           | PS_JRNL_LN       |     6 |       |   388   (0)| 00:00:05 |
    |   5 |    BUFFER SORT                |                  |   116K|  3416K|  2709   (2)| 00:00:33 |
    |   6 |     TABLE ACCESS FULL         | PS_BI_HDR        |   116K|  3416K|  2709   (2)| 00:00:33 |
    |*  7 |   TABLE ACCESS BY INDEX ROWID | PS_BI_ACCT_ENTRY |     1 |    48 |    73   (0)| 00:00:01 |
    |*  8 |    INDEX RANGE SCAN           | PS_BI_ACCT_ENTRY |     1 |       |    73   (0)| 00:00:01 |
    A few comments:
    1. Please re-edit your post and add the "Predicate Information" section below the plan, so that the filter and access predicates can be seen. They're quite helpful to understand the execution plan better.
    2. You're using bind variables, therefore the EXPLAIN PLAN output is only of limited use, since EXPLAIN PLAN doesn't perform "bind variable peeking". With "bind variable peeking" the optimizer peeks at the actual values passed when determining the execution plan. If you have a histogram generated on PS_JRNL_LN.JOURNAL_ID (check DBA/ALL/USER_TAB_COLUMNS.HISTOGRAM) or the values used are "out-of-range" (less or greater than recorded min and max value of column) then you might get different execution plans depending on the actual values passed.
    3. You can get the actual execution plan(s) from the shared pool by obtaining the SQL_ID of the statement (e.g. check V$SESSION) and use the DBMS_XPLAN.DISPLAY_CURSOR function for this SQL_ID
    4. The optimizer estimates that out of the 11 million rows of PS_JRNL_LN more or less no rows corresponds to this predicate:
    A.JOURNAL_ID = :1
    AND A.JRNL_LINE_STATUS = '1'
    Since for the unknown bind variable a hard coded default selectivity of 5% is used which corresponds to a cardinality approx. 550,000 rows, the JRNL_LINE_STATUS = '1' predicate seems to be quite selective.
    Is this estimate in the right ballpark or way off?
    Due to this estimate the optimizer uses a cartesian join which could generate a very large intermediate set if the estimate is way off, e.g. if 1,000 rows are returned instead of 0 the cartesian join will already generate 1,000 * 116,000 => 116,000,000 rows.
    This row source will then be used as driving source of a nested loop which means that many times the index and table lookup to PS_BI_ACCT_ENTRY will be performed.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • SQL query taking too long to process

    dear guys. i have this one problem, where the sql statements really took very long time to be processed. It took more than 1 minute, depending on the total data in the table. I guest this have to do with the 'count' statements. here is the code:
    $sql = "SELECT company,theID,abbs,A as Active,N as Nonactive,(A+N) as Total
    FROM(
    select distinct D.nama As company, C.domID As theID, D.abbrew As abbs,
    count(distinct case when B.ids is NOT NULL THEN A.dauserid END) As A,
    count(distinct case when B.ids is NULL THEN A.dauserid END) As N
    FROM
    tableuser A LEFT OUTER JOIN tabletranscript B on (A.dauserid=B.dauserid)
    INNER JOIN thedommember C ON(C.entitybuktiID=1 AND C.mypriority=1 AND
    C.entitybuktiID=A.dauserid)
    INNER JOIN mydomain D ON (C.domID=".$getID.")
    GROUP BY D.nama, C.domID, D.abbrew
    ORDER BY company
    Hope any of you can simplify this statements into a query that doesnt take ages to be processed.

    What yours oracle version?
    Did you gather stats?
    stats are used by the optimizer for a better assessment query plan,if yours stats is stale then query plan behave inadvertly
    Can you paste yours this specific query tracer file by using tkprof here with wait events?
    Can you avoid DISTINCT clause from urs sequel,cause DISTINCT will always require a sort and sorting slows performance?
    More or less unless if you cant go through from above statment its hard to find whats the real issue with this sequel.
    Khurram

  • Query taking too long time

    Hello all i hav a query which is taking result from 4 tables
    select name, date, emp_id, salary from table1, table2, table3,table4 where date= :date and other conditions
    but when im doing same query and changin date format
    select name, date, emp_id, salary from table1, table2, table3,table4 where date= TO_DATE(:date,'DD/MM/RRRR') and other conditions
    the query is gettin hang no response
    please advice.
    Thanks

    Execution Plan                                        
    Plan hash value: 2265139331                                        
          Id        Operation                                    Name                           Rows        Bytes       Cost (%CPU)      Time          
         0      SELECT STATEMENT                                                           14647       3146K       1443   (1)      00:00:18      
         1       HASH GROUP BY                                                             14647       3146K                                     
         2        CONCATENATION                                                                                                                    
         3         MERGE JOIN CARTESIAN                                                    8444       1814K        738   (1)      00:00:09      
         4          NESTED LOOPS                                                                                                                   
         5           NESTED LOOPS                                                          1     202        635   (1)      00:00:08      
         6            NESTED LOOPS                                                         1     138        633   (1)      00:00:08      
         7             NESTED LOOPS                                                        1     103        632   (1)      00:00:08      
         8              NESTED LOOPS                                                       1     85        631   (1)      00:00:08      
         9               VIEW                               table     3     84        628   (1)      00:00:08      
         10                UNION-ALL                                                                                                                
         * 11                  HASH JOIN                                                       1     37        279   (1)      00:00:04      
         * 12                   TABLE ACCESS BY INDEX ROWID     table     1     31          4   (0)      00:00:01      
         * 13                    INDEX RANGE SCAN               table     1                      3   (0)      00:00:01      
         14                  TABLE ACCESS FULL               table     9472     56832        275   (1)      00:00:04      
         * 15                  HASH JOIN                                                       1     37        319   (1)      00:00:04      
         * 16                   TABLE ACCESS BY INDEX ROWID     table     1     31         10   (0)      00:00:01      
         * 17                    INDEX RANGE SCAN               table     1                      9   (0)      00:00:01      
         18                  TABLE ACCESS FULL               table     36233        212K        308   (1)      00:00:04      
         * 19                  HASH JOIN                                                       1     43         31   (4)      00:00:01      
         * 20                   TABLE ACCESS BY INDEX ROWID     table     1     37          3   (0)      00:00:01      
         * 21                    INDEX RANGE SCAN               table     1                      2   (0)      00:00:01      
         22                  TABLE ACCESS FULL               table     2546     15276         27   (0)      00:00:01      
         23               TABLE ACCESS BY INDEX ROWID        table     1     57          1   (0)      00:00:01      
         * 24                 INDEX UNIQUE SCAN                 table     1                      0   (0)      00:00:01      
         25              TABLE ACCESS BY INDEX ROWID         table     1     18          1   (0)      00:00:01      
         * 26                INDEX UNIQUE SCAN                  table     1                      0   (0)      00:00:01      
         27             TABLE ACCESS BY INDEX ROWID          table     1     35          1   (0)      00:00:01      
         * 28               INDEX UNIQUE SCAN                   table     1                      0   (0)      00:00:01      
         * 29             INDEX RANGE SCAN                      table     2                      1   (0)      00:00:01      
         30           TABLE ACCESS BY INDEX ROWID            table     2     128          2   (0)      00:00:01      
         31          BUFFER SORT                                                            7977        140K        736   (1)      00:00:09      
         32           TABLE ACCESS FULL                      table     7977        140K        102   (0)      00:00:02      
         33         NESTED LOOPS                                                            310     68200        704   (1)      00:00:09      
         34          NESTED LOOPS                                                           1     202        635   (1)      00:00:08      
         35           NESTED LOOPS                                                          1     138        633   (1)      00:00:08      
         36            NESTED LOOPS                                                         1     103        632   (1)      00:00:08      
         37             NESTED LOOPS                                                        1     85        631   (1)      00:00:08      
         38              VIEW                                table     3     84        628   (1)      00:00:08      
         39               UNION-ALL                                                                                                                 
         * 40                 HASH JOIN                                                        1     37        279   (1)      00:00:04      
         * 41                  TABLE ACCESS BY INDEX ROWID      table     1     31          4   (0)      00:00:01      * 41             TABLE ACCESS BY INDEX ROWID table131     4   (0) 00:00:01
         * 42                   INDEX RANGE SCAN                table     1                      3   (0)      00:00:01      
         43                 TABLE ACCESS FULL                table     9472     56832        275   (1)      00:00:04      
         * 44                 HASH JOIN                                                        1     37        319   (1)      00:00:04      
         * 45                  TABLE ACCESS BY INDEX ROWID      table     1     31         10   (0)      00:00:01      
         * 46                   INDEX RANGE SCAN                table     1                      9   (0)      00:00:01      
         47                 TABLE ACCESS FULL                table     36233        212K        308   (1)      00:00:04      
         * 48                 HASH JOIN                                                        1     43         31   (4)      00:00:01      
         * 49                  TABLE ACCESS BY INDEX ROWID      table     1     37          3   (0)      00:00:01      
         * 50                   INDEX RANGE SCAN                table     1                      2   (0)      00:00:01      
         51                 TABLE ACCESS FULL                table     2546     15276         27   (0)      00:00:01      
         52              TABLE ACCESS BY INDEX ROWID         table     1     57          1   (0)      00:00:01      
         * 53                INDEX UNIQUE SCAN                  table     1                      0   (0)      00:00:01      
         54             TABLE ACCESS BY INDEX ROWID          table     1     18          1   (0)      00:00:01      
         * 55               INDEX UNIQUE SCAN                   table     1                      0   (0)      00:00:01      
         56            TABLE ACCESS BY INDEX ROWID           table     1     35          1   (0)      00:00:01      
         * 57              INDEX UNIQUE SCAN                    table     1                      0   (0)      00:00:01      
         58           TABLE ACCESS BY INDEX ROWID            table     2     128          2   (0)      00:00:01      
         * 59             INDEX RANGE SCAN                      table     2                      1   (0)      00:00:01      
         * 60           TABLE ACCESS FULL                       table     293     5274         68   (0)      00:00:01      
    Predicate Information (identified by operation id):                                        
       3 - access("a.id"="b.id")                                        
      12 - access("a.id"="b.id")                                        
      13 - filter("a.id"="b.id")                                        
      14 - access("a.id"="b.id")                                        
      16 - access("a.id"="b.id")                                        
      17 - filter("a.id"="b.id")                                        
      18 - access("a.id"="b.id")                                        
      20 - access("a.id"="b.id")                                        
      21 - filter("a.id"="b.id")                                        
      22 - access("a.id"="b.id")                                        
      25 - access("a.id"="b.id")AND ("a.id"="b.id")                                        
      27 - access("a.id"="b.id")                                        
      28 - access("a.id"="b.id")                                        
      32 - access("a.id"="b.id")                                        
      36 - access("a.id"="b.id")AND ("a.id"="b.id")                                        
      37 - filter("a.id"="b.id")                                        
      40 - access("a.id"="b.id")                                        
      41 - filter("a.id"="b.id")                                        
      42 - access("a.id"="b.id")                                        
      44 - access("a.id"="b.id")                                        
      45 - filter("a.id"="b.id")                                        
      46 - access("a.id"="b.id")                                        
      48 - access("a.id"="b.id")                                        
      49 - filter("a.id"="b.id")                                        
      50 - access("a.id"="b.id")                                        
    Statistics                                        
             71  recursive calls                                        
              0  db block gets                                        
           2975  consistent gets                                        
              0  physical reads                                        
              0  redo size                                        
           2172  bytes sent via SQL*Net to client                                        
            520  bytes received via SQL*Net from client                                        
              2  SQL*Net roundtrips to/from client                                        
              1  sorts (memory)                                        
              0  sorts (disk)                                        
              1  rows processed

Maybe you are looking for

  • Any way to tap into USB internally in a Mac Pro?

    I have a 2008 quad-core (not a 8-core, mine's a "CTO") Mac-Pro. An outfit called Koutech Systems makes 8-port RS-232 PCI-e cards. Problem is, it needs to tap into a USB header-pin connector on the mother board, or plug into an internal USB port. I th

  • Reg - dropdownlist  and Table

    hi all i have a requirement in my application i have view with two UI element one is a Table i.e., a Nested Tree Table which is on top and a DropDownKey list below the table.  The Dropdown contains Student, Employee, Faculty and so on.  When  i selec

  • Logview of process chain

    hi experts ,in my case on of the  process chain turns into red color ,due to invalid characters and showing the error that invalid characters ,so at that time ,i made corrections form the error stack and executes the error dtp,the load successfully l

  • Sony NEX-5R ARW

    I recently bought a Sony NEX-5R but Aperure can´t view the RAW-files (.ARW). I know ARW is different for each camera, and the NEX-5R is new on the market, so I wonder if anyone know if Aperture supports it yet, or if the problem is on my local machin

  • Photos from the PC does not appear on iOS devices

    Win7-64 installed icloud 2.0. Iphone 4, iPad new (iOS 6) I put the photos in the folder uploads, they appear on your computer in the my photostream, but do not appear on ios devices. Climbed into the iPhone file manager and found an interesting pictu