Research on freelists and Freelist groups (revised edition)-How many free lists are there

Source: Internet
Author: User
Tags commit header insert
Four              how many kinds of free list1 are available. The   Master free list, or segment, is MFL, automatically generated when segment is created, if we do not specify a freelists parameter when creating the segment, or if you specify freelists= 1, it's all about generating this MFL. MFL for each segment there is and only one (if you specify freelists>1, the result is not MFL, which will be explained in the Process free list section). MFL is equivalent to a pool of free space, when a segment is created and the new block dynamically allocated later is linked to MFL, all the free blocks in this pool are shared by all processes, All processes that have insert operations for the segment may read this free list, so that when multiple processes are to insert data at the same time, contention on the MFL may occur (MFL can only allow one process to get an idle block at a time, of course, In fact, the process from the MFL read the free block of the operation is not simply how much to take, and then directly to the block to insert data, the actual process to be more complex, the process in the "Process request Free block Process" section will have detailed description. From this, introduced the concept of freelist groups, set freelist groups parameter is greater than 1 is set up a number of MFL, so as to ease the contention for MFL. More detailed information about freelist groups is described in the "Super Master free list" section.  2. Process free list If the process must read the idle block directly from the MFL, then the contention for MFL is resolved by the Freelist groups parameter (setting multiple MFL), but there is obviously another way to keep the process from directly reading the MFL. There is no need to contend with no demand. This introduces another level of free list, which is the process free list, referred to as PFL. When we specify the storage parameter freelists>1, the result is PFL. As we said earlier, MFL is generated automatically when segment is created, so there are still 1 MFL for each segment, whether it is PFL or not. That is, if we define freelists equals 2,Then there will be a total of 3 freelist in the segment header block, of which 1 are MFL and 2 are PFL. We can also verify this by dumping dump information. SEG LST:: flg:unused lhd:0x00000000 ltl:0x00000000 SEG LST:: flg:unused lhd:0x00000000 ltl:0x00000000 SEG LST:: FLG: used   lhd:0x01c0008b ltl:0x01c0008b The back two free list is PFL, and the previous one is MFL. As the name suggests, now that the process free list is named, the idle block at this level is obviously only read by a single processing. Imagine that if the current system has at most 10 simultaneous inserts for a table, then we set the freelists=10 and will be able to use our own free list as much as possible, and by this means we have eased free Contention for the list. Which pfl,oracle internal algorithm is used by a process: (p% NFL) + 1 where p represents the process ID of the DML operation processes, which can be obtained from the V$process.pid field. The NFL represents the number of PFL defined by the freelists storage parameter. There may be doubt, if so, is there a need for multiple MFL? We just need to set up multiple PFL. However, this is not the case, but please do not be impatient, explained in the following "process request free block process" will explain this problem.  3. Transaction free list in Oracle transactions (transaction) is an important concept, each DML operation, the beginning of the transaction is automatic, and we can through a commit or rollback to flag the end of a transaction. A process (or a user session) has its own PFL, then a process may execute a lot of transactions, and then there is this level of free list, this is transaction free list, referred to as TfL. TfL is generated dynamically, only if the DML statement (such as delete or update) causes the block occupancy to fall below the pctused parameter specified value, a TFL only belongs to one transaction, and a transaction has only one TfL, and a transaction is not committed before Free blocks on the TfL of this transaction are not to be replaced by other transactionsUse. But can be used immediately by this transaction (at which time these free blocks are called previously freed blocks). Each segment can have at least 16 TfL and dynamically increase the number of TfL whenever there is a demand, unless the segment header block size is reached. When there is no room to allow a new transaction to get its own TfL, the transaction must wait for the other transaction to commit and release the TfL. The algorithm that waits for which transaction is: (p% NFL) where p represents the process ID of the DML operation processes, which can be obtained from the V$process.pid field. The NFL represents the current total number of TfL. With dump dump block information, we can see something similar to the following: XCT LST:: flg:used   lhd:0x01c0008c ltl:0x01c0008a XID: 0X0008.01F.000003D2 where XID represents the transaction ID, the format of the transaction ID and the meaning of the expression, interested readers can view other information.  4. A free list of Super master free list or segment Master free list is only available when multiple freelist groups are set. When we set freelist group>1, we produce freelist group block, which is immediately following the segment header block, assuming we set up storage (freelists 4 Freelist groups 2), the first block of the segment is segment header blocks, 2nd, and 3 blocks are freelist group block. First there are 1 free lists in the segment header block, and this free list is called the Super Master Free list or the segment Master free list. In each freelist group block, there are 1 MFL, 4 PFL, and the remaining space of each freelist group blocks is reserved for TfL use. The algorithm that processes select Freelist group in a single instance is (P% NFB) + 1. where p represents the process ID of the DML operation processes, can be from the V$process.piThe D field is obtained. NFB represents the number of freelist groups defined by the freelist groups parameter. The algorithms in the RAC environment are more complex, and this article is not discussed. View the dump file for Freelist group block to see something similar to the following: frmt:0x02 chkval:0x0000 type:0x16=data SEGMENT free LIST count  blocks in free list = 5 ccnt = 0   SEG LST:: flg:unused lhd:0x00000000 ltl:0x00000000   SEG LST:: flg:unused lhd:0x00000000 ltl:0x00000000   SEG LST:: flg:unused lhd:0x00000000 ltl:0x00000000   SEG LST:: flg:used   lhd:0x01c00116 ltl:0x01c0011a SEG LST:: flg:unused lhd:0x00000000 ltl:0x00000000

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.