• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 613
  • Last Modified:

delete takes a long time on table hash partitioned

emp table is  PARTITION BY HASH (emp_no)  PARTITIONS 100 and the table has 100 million rows.

The following delete takes a long time.  I think it is accessing all the 100 partitions.  So how to make the delete faster in this case?  That may be the problem with HASH partition itself.  Thanks.
Delete from emp table where year =2008 and month =1
0
ewang1205
Asked:
ewang1205
  • 4
  • 2
3 Solutions
 
ewang1205Author Commented:
Will create an index on year/month make this delete faster?  Thanks.
0
 
johnsoneSenior Oracle DBACommented:
You are deleting based on criteria that are not part of the partition key.  It would have to go through all the partitions to do the delete.

Creating a local index on the year/month should speed up the process.
0
 
ewang1205Author Commented:
johnsone: thanks for the help.  Try the index and working great so far.  Much faster now.  Will test more.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sujith80Commented:
I would suggest you to partition the table based on your most frequent operations.

If you are interested to access/manage the data based on the date, you may better range partition by date. That will hit the selected partitions directly.
0
 
ewang1205Author Commented:
I view data by emp_no, load data by year/month.  So I partition by emp_no to speed up the view data, but I am running into the slow loading problem.  I may think to partition by year/month and subpartition by emp_no!!  What do you think?  Thanks.
0
 
sujith80Commented:
>> I may think to partition by year/month and subpartition by emp_no
May not help. As you are viewing the data bases on emp_no, you may hit many partitions just to query one single emp_no, provided you are maintaining the historical data in the table.

How much is the retention in the table? Can records with the same emp_no be present in the table for different dates?
0
 
ewang1205Author Commented:
100 million totaly for 3 years.  Year view same emp_no for different months and that is the problem.  Thanks.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now