I had a large table where I needed to delete millions of rows. It would take an awfully long time, so I created a new one via CTAS without the records I wanted to delete. Over this table I created the same indexes and foreign keys as on the original, then deleted the original table. I had the statistics recalculated. Everything was done quickly and without problems. However, working with the table is strangely slower now. FORALL delete of records on the primary key takes longer (still index fast full scan), even though the execution plan is the same. What to do about it?
Oracle query speed after CTAS
25 Views Asked by user2595886 At
1
There are 1 best solutions below
Related Questions in ORACLE
- sqlplus myusername/mypassword@ORCL not working with Oracle on Docker
- Oracle setting up on k8s cluster using helm charts enterprise edition
- Oracle Managed Data Access Client can't work from IIS but work for local debug environment
- If composite indexing created - indexing is called?
- Oracle Http server ISNT-07551
- why here not creating table?
- Data migration from Oracle Database Clob to GCP Bucket
- SQL Alchemy custom type, forcing blob bind parameter
- How to send message to syslog agent in plsql
- Whatever the data available in previous record it should add to the new record
- I have an Oracle SQL query that is giving me a "ORA-00918: column ambiguously defined" error on a line that is a comment line
- 'ORA-12170: TNS:Connect timeout occurredORA-12170: TNS:Connect timeout occurred' ERROR while working on oracle with laravel
- Is their any way i can open parallel query tabs
- VSCode Libraries not showing for New Java Project
- I can't ssh to my instance, Connection refused
Related Questions in STATISTICS
- How to make pandas show large datasets in output?
- How to construct polygons from a 2D data to compute spatial autocorrelation in R
- Is python statsmodel elastic net regression automatically standard deviation deflated?
- How can I emulate Microsoft Excel's Solver functionality (GRG Nonlinear) in python?
- How do I find the probability that one of my probabilities will occur?
- Timeline-ish data to Occurence/Exposure data
- Handling Error Propagation Above Biological Thresholds in R with predictNLS
- Why is there such a difference between chi2 and mcnemar?
- Handling Nested One-Level Random Effects in Linear Mixed Models in R
- Model failed to converge (gamma model, self-paced reading data)
- How to quantify the consistency of a sequence of predictions, incl. prediction confidence, using standard function from sklearn or a similar library
- P-values for each comparison in a Kruskal post hoc test in R?
- R Metaprop P-value overlapping with forest plot axes
- Monte Carlo simulation Lotto Germany
- How does emmeans adjust the p-values when using "Tukey" as adjustment method? (Solved)
Related Questions in SQL-EXECUTION-PLAN
- plan_handle is always different for each query in SQL Server Cache
- Stored Procedure Taking very Long to execute
- What does Type "ref|filter" mean in mariaDB Explain Output
- Select query takes too long to execute
- PostgreSQL Hash Join vs Nested Loop and hash index
- How do I test the performance of an SQL query with parameters in SSMS?
- Performance Issues After Migrating from MariaDB 10.3.39 to 10.6.16 Due to Changes in Query Execution Plan
- Exact meaning of actual times in PostgreSQL explain analyze
- How to improve sort performance in a huge dataset of 20 million rows?
- PostgreSQL query plans when using unnest() in SELECT list vs in subquery
- Postgres nested loop not used in recursive query
- Terrible performance joining a view to a fast subquery / CTE in PostgreSQL
- SQL Server restart/large database restore impacting stored procedure unexpectedly
- Efficient many-to-many embedding comparisons
- Two identical MariaDB slaves, two different execution plans
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Two common ways a CTAS may slow down a table is by missing a crucial table property like compression, or loading the table in a different order that reduces index performance.
Compression
Are you sure you perfectly recreated the new table? Perhaps you forgot an important table property, like compression. The below example demonstrates how a property like compression is not automatically copied over to the new table:
You can check the table properties with a query like
SELECT * FROM DBA_TABLES, or you can get the entire table DDL with a query likeselect dbms_metadata.get_ddl('TABLE', 'TABLE_NAME') from dual;Clustering Factor
Even if the data structures and data are identical, the order the data was physically loaded can have a performance impact. For example, indexes can read from the table more efficiently when the relevant columns are inserted in order. This happens because each index entry contains a pointer to a block of data from the table, which is usually 8KB. Since indexes are usually read in order, it's a lot more efficient if ordered values are stored next to each other. If the table values are completely disordered, you may end up with a situation where reading 1% of the values from an index requires pulling 100% of the blocks from the table.
The clustering factor is a measure of how efficient the index is, which is related to how ordered the data is. The below query shows that ordering data can make a huge impact.
Fixes
You can either recreate your table or alter it to solve compression:
For ordering data, there are some advanced features like clustering, but it might be simpler to just redo the CTAS and add an
ORDER BYclause if necessary.