Thanks for the question, Nikolas .
Asked: March 10, 2021 - 8:39 am UTC
Last updated: March 10, 2021 - 2:21 pm UTC
Version: 11.2.0.4.0
Viewed 1000+ times
You Asked
Dear Sir/Madam,
In our setup we have multiple java jobs fetching and writing to couple of tables (some of the jobs are hitting the same tables at the same time).
The tables are partitioned on business date.
My first question is, will the table be locked if 2 or more jobs start hitting the same table (the one needs to read and the other to write)?
The tables can be subpartitioned to multiple locations as well, in a symmetric way.
My second question is, will each subpartition act like a separate table? Will subpartition increase performance of the the query? If two or more jobs hit the same table, same business date but different subpartition will oracle execute the 2 queries in parallel (like they are two different partitions)?
Thank you for your time.
Best,
Nikolas
and Chris said...
will the table be locked if 2 or more jobs start hitting the same table (the one needs to read and the other to write)?NO!
One of Oracle Database's great strengths is:
Readers NEVER block writersAs the docs say:
Nonblocking queries
Readers and writers of data do not block one another.
https://docs.oracle.com/en/database/oracle/oracle-database/21/cncpt/data-concurrency-and-consistency.html#GUID-4BD4DFD6-DAEA-41B2-BB56-7135568F0548 will each subpartition act like a separate table?Yes and no. You can perform many operations at the (sub)partition level. And you can limit DML operations to a single partition - provided you include all the partitioning columns in their where clause.
Will subpartition increase performance of the the query?Maybe
Partitioning is a big topic - I suggest reviewing Connor's primer on this to help you understand it better
https://asktom.oracle.com/partitioning-for-developers.htm If two or more jobs hit the same table, same business date but different subpartition will oracle execute the 2 queries in parallel (like they are two different partitions)?Any two sessions can query the table at the same time. It doesn't matter whether they're reading different partitioning or exactly the same rows. Both can run in parallel.
You can also have two or more sessions writing to the table at the same time. Writers can block each other in some cases - the classic example is two sessions updating/deleting the same rows. It's common to have many processes writing to a table with
no blocking though.
Is this answer out of date? If it is, please let us know via a Comment