{"id":292005,"date":"2019-07-12T15:01:14","date_gmt":"2019-07-12T15:01:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=292005"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=292005","title":{"rendered":"\u041f\u043e \u0441\u043b\u0435\u0434\u0430\u043c Highload++ Siberia 2019 \u2014 8 \u0437\u0430\u0434\u0430\u0447 \u043f\u043e Oracle"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u041f\u0440\u0438\u0432\u0435\u0442!<\/p>\n<p>  24-25 \u0438\u044e\u043d\u044f \u0432 \u041d\u043e\u0432\u043e\u0441\u0438\u0431\u0438\u0440\u0441\u043a\u0435 \u043f\u0440\u043e\u0448\u043b\u0430 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u044f Highload++ Siberia 2019. \u041d\u0430\u0448\u0438 \u0440\u0435\u0431\u044f\u0442\u0430 \u0442\u043e\u0436\u0435 \u0442\u0430\u043c \u0431\u044b\u043b\u0438 <a href=\"https:\/\/www.highload.ru\/siberia\/2019\/abstracts\/5211\">\u0434\u043e\u043a\u043b\u0430\u0434\u043e\u043c<\/a> \u00ab\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043d\u044b\u0435 \u0431\u0430\u0437\u044b Oracle (CDB\/PDB) \u0438 \u0438\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u041f\u041e\u00bb, \u043c\u044b \u0432\u044b\u043b\u043e\u0436\u0438\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0436\u0435. \u0411\u044b\u043b\u043e \u043a\u0440\u0443\u0442\u043e, \u0441\u043f\u0430\u0441\u0438\u0431\u043e <a href=\"https:\/\/habr.com\/ru\/users\/olegbunin\/\" class=\"user_link\">olegbunin<\/a> \u0437\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u043f\u0440\u0438\u0448\u0451\u043b. <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/-7\/k4\/u1\/-7k4u1btcjxquu515qeoyxnxigu.jpeg\" width=\"350\"><\/div>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0441\u0442\u0435\u043d\u0434\u0435, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0432 Oracle. \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u2014 8 \u0437\u0430\u0434\u0430\u0447, \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u041a\u0430\u043a\u043e\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u043a\u0432\u0435\u043d\u0441\u0430 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430?<\/h3>\n<p>  <\/p>\n<pre><code class=\"sql\">create sequence s start with 1;   select s.currval, s.nextval, s.currval, s.nextval, s.currval from dual connect by level &lt;= 5; <\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>1<\/li>\n<li>5<\/li>\n<li>10<\/li>\n<li>25<\/li>\n<li>\u041d\u0438\u043a\u0430\u043a\u043e\u0433\u043e, \u0431\u0443\u0434\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Oracle (\u0446\u0438\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 8.1.6):<br \/>  Within a single SQL statement, Oracle will increment the sequence only once per row. If a statement contains more than one reference to NEXTVAL for a sequence, Oracle increments the sequence once and returns the same value for all occurrences of NEXTVAL. If a statement contains references to both CURRVAL and NEXTVAL, Oracle increments the sequence and returns the same value for both CURRVAL and NEXTVAL regardless of their order within the statement.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, <b>\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u0443 \u0441\u0442\u0440\u043e\u043a, \u0442\u043e \u0435\u0441\u0442\u044c 5<\/b>.  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430?<\/h3>\n<p>  <\/p>\n<pre><code class=\"sql\">create table t(i integer check (i &lt; 5));   create procedure p(p_from integer, p_to integer) as begin     for i in p_from .. p_to loop         insert into t values (i);     end loop; end; \/   exec p(1, 3); exec p(4, 6); exec p(7, 9);<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>0<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>9<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Oracle (\u0446\u0438\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 11.2):<\/p>\n<p>  Before executing any SQL statement, Oracle marks an implicit savepoint (not available to you). Then, if the statement fails, Oracle rolls it back automatically and returns the applicable error code to SQLCODE in the SQLCA. For example, if an INSERT statement causes an error by trying to insert a duplicate value in a unique index, the statement is rolled back.<\/p>\n<p>  \u0412\u044b\u0437\u043e\u0432 \u0425\u041f \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a single statement. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0425\u041f \u0431\u043b\u0430\u0433\u043e\u043f\u043e\u043b\u0443\u0447\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f, \u0432\u0441\u0442\u0430\u0432\u0438\u0432 \u0442\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438; \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 \u0425\u041f \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0438 \u043e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0447\u0435\u0442\u0432\u0451\u0440\u0442\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0443\u0441\u043f\u0435\u043b \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c; \u0442\u0440\u0435\u0442\u0438\u0439 \u0432\u044b\u0437\u043e\u0432 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439, <b>\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438<\/b>.  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430?<\/h3>\n<p>  <\/p>\n<pre><code class=\"sql\">create table t(i integer, constraint i_ch check (i &lt; 3));   begin     insert into t values (1);     insert into t values (null);     insert into t values (2);     insert into t values (null);     insert into t values (3);     insert into t values (null);     insert into t values (4);     insert into t values (null);     insert into t values (5); exception     when others then         dbms_output.put_line('Oops!'); end; \/<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>1<\/li>\n<li>2<\/li>\n<li>3<\/li>\n<li>4<\/li>\n<li>5<\/li>\n<li>6<\/li>\n<li>7<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Oracle (\u0446\u0438\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 11.2):<\/p>\n<p>  A check constraint lets you specify a condition that each row in the table must satisfy. To satisfy the constraint, each row in the table must make the condition either TRUE or unknown (due to a null). When Oracle evaluates a check constraint condition for a particular row, any column names in the condition refer to the column values in that row.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 null \u043f\u0440\u043e\u0439\u0434\u0451\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0438 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 3. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0431\u043b\u043e\u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u043e\u0433\u0430\u0441\u0438\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043e\u0442\u043a\u0430\u0442\u0430 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0438 <b>\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u0442\u0440\u043e\u043a\u0438<\/b> \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 1, null, 2 \u0438 \u0441\u043d\u043e\u0432\u0430 null.  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041a\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0437\u0430\u0439\u043c\u0443\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0451\u043c\u044b \u043c\u0435\u0441\u0442\u0430 \u0432 \u0431\u043b\u043e\u043a\u0435?<\/h3>\n<p>  <\/p>\n<pre><code class=\"sql\">create table t (     a char(1 char),     b char(10 char),     c char(100 char),     i number(4),     j number(14),     k number(24),     x varchar2(1 char),     y varchar2(10 char),     z varchar2(100 char));   insert into t (a, b, i, j, x, y)     values ('Y', '\u0412\u0430\u0441\u044f', 10, 10, '\u0414', '\u0412\u0430\u0441\u044f'); <\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>A \u0438 X<\/li>\n<li>B \u0438 Y<\/li>\n<li>C \u0438 K<\/li>\n<li>C \u0438 Z<\/li>\n<li>K \u0438 Z<\/li>\n<li>I \u0438 J<\/li>\n<li>J \u0438 X<\/li>\n<li>\u0412\u0441\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0438 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (12.1.0.2) \u043f\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Oracle.<\/p>\n<p>  <b>CHAR Data Type<\/b><br \/>  The CHAR data type specifies a fixed-length character string in the database character set. You specify the database character set when you create your database. Oracle ensures that all values stored in a CHAR column have the length specified by size in the selected length semantics. If you insert a value that is shorter than the column length, then Oracle blank-pads the value to column length.<\/p>\n<p>  <b>VARCHAR2 Data Type<\/b><br \/>  The VARCHAR2 data type specifies a variable-length character string in the database character set. You specify the database character set when you create your database. Oracle stores a character value in a VARCHAR2 column exactly as you specify it, without any blank-padding, provided the value does not exceed the length of the column.<\/p>\n<p>  <b>NUMBER Data Type<\/b><br \/>  The NUMBER data type stores zero as well as positive and negative fixed numbers with absolute values from 1.0 x 10-130 to but not including 1.0 x 10126. If you specify an arithmetic expression whose value has an absolute value greater than or equal to 1.0 x 10126, then Oracle returns an error. Each NUMBER value requires from 1 to 22 bytes. Taking this into account, the column size in bytes for a particular numeric data value NUMBER(p), where p is the precision of a given value, can be calculated using the following formula: <i>ROUND((length(p)+s)\/2))+1<\/i> where s equals zero if the number is positive, and s equals 1 if the number is negative.<\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0432\u044b\u0434\u0435\u0440\u0436\u043a\u0443 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430\u0441\u0447\u0435\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f Null\u2013\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p>  A null is the absence of a value in a column. Nulls indicate missing, unknown, or inapplicable data. Nulls are stored in the database if they fall between columns with data values. In these cases, they require 1 byte to store the length of the column (zero). Trailing nulls in a row require no storage because a new row header signals that the remaining columns in the previous row are null. For example, if the last three columns of a table are null, then no data is stored for these columns.<\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u0442\u0440\u043e\u0438\u043c \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f. \u0421\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u0432 \u0411\u0414 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0430 AL32UTF8. \u0412 \u044d\u0442\u043e\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435 \u0440\u0443\u0441\u0441\u043a\u0438\u0435 \u0431\u0443\u043a\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c 2 \u0431\u0430\u0439\u0442\u0430.<\/p>\n<p>  1) A \u0438 X, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f a &#8216;Y&#8217; \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 1 \u0431\u0430\u0439\u0442, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f x \u2018\u0414\u2019 \u2013 2 \u0431\u0430\u0439\u0442\u0430<br \/>  2) B \u0438 Y, \u2018\u0412\u0430\u0441\u044f\u2019 \u0432 b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438 \u0434\u043e 10 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u0437\u0430\u0439\u043c\u0451\u0442 14 \u0431\u0430\u0439\u0442, \u2018\u0412\u0430\u0441\u044f\u2019 \u0432 d \u2013 \u0437\u0430\u0439\u043c\u0435\u0442 8 \u0431\u0430\u0439\u0442.<br \/>  3) C \u0438 K. \u041e\u0431\u0430 \u043f\u043e\u043b\u044f \u0438\u043c\u0435\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 NULL, \u043f\u043e\u0441\u043b\u0435 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0435 \u043f\u043e\u043b\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u043f\u043e 1 \u0431\u0430\u0439\u0442\u0443.<br \/>  4) C \u0438 Z. \u041e\u0431\u0430 \u043f\u043e\u043b\u044f \u0438\u043c\u0435\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 NULL, \u043d\u043e \u043f\u043e\u043b\u0435 Z \u2013 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0435\u0441\u0442\u0430 \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 (0 \u0431\u0430\u0439\u0442). \u041f\u043e\u043b\u0435 \u0421 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 1 \u0431\u0430\u0439\u0442.<br \/>  5) K \u0438 Z. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u0441\u043b\u0443\u0447\u0430\u044e. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043f\u043e\u043b\u0435 K \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 1 \u0431\u0430\u0439\u0442, \u0432 Z \u2013 0.<br \/>  6) I \u0438 J. \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u043e\u0431\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0439\u043c\u0443\u0442 \u043f\u043e 2 \u0431\u0430\u0439\u0442\u0430. \u0414\u043b\u0438\u043d\u0443 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043e \u0432\u0437\u044f\u0442\u043e\u0439 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u044b: round( (1 + 0)\/2) +1 = 1 + 1 = 2.<br \/>  7) J \u0438 X. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043f\u043e\u043b\u0435 J \u0437\u0430\u0439\u043c\u0435\u0442 2 \u0431\u0430\u0439\u0442, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043f\u043e\u043b\u0435 X \u0437\u0430\u0439\u043c\u0435\u0442 2 \u0431\u0430\u0439\u0442\u0430.<\/p>\n<p>  <b>\u0418\u0442\u043e\u0433\u043e, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b: \u0421 \u0438 Z, I \u0438 J, J \u0438 X.<\/b>  <\/div>\n<\/div>\n<h3>\u041a\u0430\u043a\u043e\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0431\u0443\u0434\u0435\u0442 clustering factor \u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 T_I?<\/h3>\n<p>  <\/p>\n<pre><code class=\"sql\">create table t (i integer);   insert into t select rownum from dual connect by level &lt;= 10000;   create index t_i on t(i); <\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>\u041f\u043e\u0440\u044f\u0434\u043a\u0430 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432<\/li>\n<li>\u041f\u043e\u0440\u044f\u0434\u043a\u0430 \u0441\u043e\u0442\u0435\u043d<\/li>\n<li>\u041f\u043e\u0440\u044f\u0434\u043a\u0430 \u0442\u044b\u0441\u044f\u0447<\/li>\n<li>\u041f\u043e\u0440\u044f\u0434\u043a\u0430 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0442\u044b\u0441\u044f\u0447<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Oracle (\u0446\u0438\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 12.1):<\/p>\n<p>  For a B-tree index, the index clustering factor measures the physical grouping of rows in relation to an index value.<\/p>\n<p>  The index clustering factor helps the optimizer decide whether an index scan or full table scan is more efficient for certain queries). A low clustering factor indicates an efficient index scan.<\/p>\n<p>  A clustering factor that is close to the number of blocks in a table indicates that the rows are physically ordered in the table blocks by the index key. If the database performs a full table scan, then the database tends to retrieve the rows as they are stored on disk sorted by the index key. A clustering factor that is close to the number of rows indicates that the rows are scattered randomly across the database blocks in relation to the index key. If the database performs a full table scan, then the database would not retrieve rows in any sorted order by this index key.<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 clustering factor \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d \u0438\u043b\u0438 \u0431\u043b\u0438\u0437\u043e\u043a \u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0437\u0430\u043d\u044f\u0442\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u0414\u043b\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u043b\u043e\u043a\u0430 \u0432 8 \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442 \u043c\u043e\u0436\u043d\u043e \u043e\u0436\u0438\u0434\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u043e\u0434\u0438\u043d \u0431\u043b\u043e\u043a \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0441\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0442\u044b\u0441\u044f\u0447\u0438 \u0443\u0437\u043a\u0438\u0445 number \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u043b\u043e\u043a\u043e\u0432, \u0438 \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 clustering factor \u0431\u0443\u0434\u0435\u0442 <b>\u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432<\/b>.  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438 \u043a\u0430\u043a\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 N \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0411\u0414 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438?<\/h3>\n<p>  <\/p>\n<pre><code class=\"sql\">create table t (     a varchar2(N char),     b varchar2(N char),     c varchar2(N char),     d varchar2(N char));   create index t_i on t (a, b, c, d); <\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>100<\/li>\n<li>200<\/li>\n<li>400<\/li>\n<li>800<\/li>\n<li>1600<\/li>\n<li>3200<\/li>\n<li>6400<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Oracle (\u0446\u0438\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 11.2):<\/p>\n<p>  Logical Database Limits<\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<td><strong>Item<\/strong><\/td>\n<td><strong>Type of Limit<\/strong><\/td>\n<td><strong>Limit Value<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Indexes<\/td>\n<td>Total size of indexed column<\/td>\n<td>75% of the database block size minus some overhead<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0435\u0432\u043e\u0441\u0445\u043e\u0434\u0438\u0442\u044c 6\u041a\u0431. \u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 \u0431\u0430\u0437\u044b. \u0414\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 AL32UTF8 \u043e\u0434\u0438\u043d \u0441\u0438\u043c\u0432\u043e\u043b \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 4 \u0431\u0430\u0439\u0442\u0430, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 6 \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442 \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0441\u044f \u043e\u043a\u043e\u043b\u043e 1500 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 Oracle \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u0440\u0438 N = 400 (\u043a\u043e\u0433\u0434\u0430 \u0434\u043b\u0438\u043d\u0430 \u043a\u043b\u044e\u0447\u0430 \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 1600 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 * 4 \u0431\u0430\u0439\u0442\u0430 + \u0434\u043b\u0438\u043d\u0430 rowid), \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a <b>\u043f\u0440\u0438 N = 200 (\u0438 \u043c\u0435\u043d\u044c\u0448\u0435)<\/b> \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c.  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 INSERT \u0441 \u0445\u0438\u043d\u0442\u043e\u043c APPEND \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 direct-\u0440\u0435\u0436\u0438\u043c\u0435. \u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442, \u0435\u0441\u043b\u0438 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u0438\u0441\u0438\u0442 \u0442\u0440\u0438\u0433\u0433\u0435\u0440?<\/h3>\n<p>  <\/p>\n<ul>\n<li>\u0414\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u0432 direct-\u0440\u0435\u0436\u0438\u043c\u0435, \u0442\u0440\u0438\u0433\u0433\u0435\u0440 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u0435\u043d<\/li>\n<li>\u0414\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u0432 direct-\u0440\u0435\u0436\u0438\u043c\u0435, \u043d\u043e \u0442\u0440\u0438\u0433\u0433\u0435\u0440 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u043d\u0435 \u0431\u0443\u0434\u0435\u0442<\/li>\n<li>\u0414\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u0432 conventional-\u0440\u0435\u0436\u0438\u043c\u0435, \u0442\u0440\u0438\u0433\u0433\u0435\u0440 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u0435\u043d<\/li>\n<li>\u0414\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u0432 conventional-\u0440\u0435\u0436\u0438\u043c\u0435, \u043d\u043e \u0442\u0440\u0438\u0433\u0433\u0435\u0440 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u043d\u0435 \u0431\u0443\u0434\u0435\u0442<\/li>\n<li>\u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b, \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0430<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u044d\u0442\u043e \u0432\u043e\u043f\u0440\u043e\u0441 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430 \u043b\u043e\u0433\u0438\u043a\u0443. \u0414\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u044f \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u0431\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0439:<\/p>\n<ol>\n<li>\u0412\u0441\u0442\u0430\u0432\u043a\u0430 \u0432 direct \u0440\u0435\u0436\u0438\u043c\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u044f\u043c\u044b\u043c \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u043b\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u0438\u043c\u043e SQL-\u0434\u0432\u0438\u0436\u043a\u0430, \u0447\u0442\u043e \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430 \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u043b\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0438 \u0441\u043c\u044b\u0441\u043b\u0430 \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442 \u0432\u0441\u0442\u0430\u0432\u043a\u0443.<\/li>\n<li>\u041d\u0435\u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0432 \u0446\u0435\u043b\u043e\u043c (\u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446) \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0442\u043e\u0433\u043e, \u0432 \u043a\u0430\u043a\u043e\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u0435\u0436\u0438\u043c\u0435 \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435. \u042d\u0442\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u0440\u0430\u0437\u0440\u0443\u0448\u0438\u0442 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043e \u043a\u0430\u043a \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 production.<\/li>\n<li>\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u0432\u043e\u043e\u0431\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0442\u0440\u0430\u043a\u0442\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0448\u0438\u0431\u043a\u0430. \u041d\u043e \u0437\u0434\u0435\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e APPEND \u2013 \u0445\u0438\u043d\u0442, \u0430 \u043e\u0431\u0449\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0445\u0438\u043d\u0442\u043e\u0432 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0436\u0435 \u043d\u0435\u0442 \u2013 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u0443\u0447\u0451\u0442\u0430 \u0445\u0438\u043d\u0442\u0430.<\/li>\n<\/ol>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u2013 <b>\u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c (SQL) \u0440\u0435\u0436\u0438\u043c\u0435, \u0442\u0440\u0438\u0433\u0433\u0435\u0440 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/b><\/p>\n<p>  \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Oracle (\u0446\u0438\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 8.04):<\/p>\n<p>  Violations of the restrictions will cause the statement to execute serially, using the conventional insert path, without warnings or error messages. An exception is the restriction on statements accessing the same table more than once in a transaction, which can cause error messages.<br \/>  For example, if triggers or referential integrity are present on the table, then the APPEND hint will be ignored when you try to use direct-load INSERT (serial or parallel), as well as the PARALLEL hint or clause, if any.<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430?<\/h3>\n<p>  <\/p>\n<pre><code class=\"sql\">create table t(i integer not null primary key, j integer references t);   create trigger t_a_i after insert on t for each row declare     pragma autonomous_transaction; begin     insert into t values (:new.i + 1, :new.i);     commit; end; \/   insert into t values (1, null); <\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>\u0423\u0441\u043f\u0435\u0448\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435<\/li>\n<li>\u0421\u0431\u043e\u0439 \u0438\u0437-\u0437\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438<\/li>\n<li>\u041e\u0448\u0438\u0431\u043a\u0430, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/li>\n<li>\u041e\u0448\u0438\u0431\u043a\u0430, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u0438\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432<\/li>\n<li>\u041e\u0448\u0438\u0431\u043a\u0430, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435\u043c \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430<\/li>\n<li>\u041e\u0448\u0438\u0431\u043a\u0430, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0441 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430\u043c\u0438<\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0442\u0432\u0435\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0438 \u0442\u0440\u0438\u0433\u0433\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0438 \u044d\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c. \u0410\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0435 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u044b, \u0438\u043d\u0430\u0447\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430 \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u0431\u044b \u043a \u0432\u0441\u0442\u0430\u0432\u043a\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0447\u0435\u043c \u0441\u043d\u043e\u0432\u0430 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0431\u044b \u0442\u0440\u0438\u0433\u0433\u0435\u0440, \u0432\u0441\u0442\u0430\u0432\u0438\u043b \u0431\u044b \u0442\u0440\u0435\u0442\u044c\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 statement \u043d\u0435 \u0443\u043f\u0430\u043b \u0431\u044b \u0438\u0437-\u0437\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e, \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0442\u043e\u043d\u043a\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u0412 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0435\u0449\u0451 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d commit. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0440\u0438\u0433\u0433\u0435\u0440, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0432 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0442\u0440\u043e\u043a\u0443, \u0441\u0441\u044b\u043b\u0430\u044e\u0449\u0443\u044e\u0441\u044f \u043f\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c\u0443 \u043a\u043b\u044e\u0447\u0443 \u043d\u0430 \u0435\u0449\u0451 \u043d\u0435 \u0437\u0430\u043a\u043e\u043c\u043c\u0438\u0447\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044e (\u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u0430\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0436\u0434\u0451\u0442 \u043a\u043e\u043c\u043c\u0438\u0442\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435) \u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0436\u0434\u0451\u0442 \u043a\u043e\u043c\u043c\u0438\u0442\u0430 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e\u0441\u043b\u0435 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430. <b>\u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 deadlock \u0438 \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u2013 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u0430\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u043e\u0442\u0441\u0442\u0440\u0435\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0439 \u0441 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430\u043c\u0438<\/b>.  <\/div>\n<\/div>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/sportmaster_lab\/blog\/459680\/\"> https:\/\/habr.com\/ru\/company\/sportmaster_lab\/blog\/459680\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u041f\u0440\u0438\u0432\u0435\u0442!<\/p>\n<p>  24-25 \u0438\u044e\u043d\u044f \u0432 \u041d\u043e\u0432\u043e\u0441\u0438\u0431\u0438\u0440\u0441\u043a\u0435 \u043f\u0440\u043e\u0448\u043b\u0430 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u044f Highload++ Siberia 2019. \u041d\u0430\u0448\u0438 \u0440\u0435\u0431\u044f\u0442\u0430 \u0442\u043e\u0436\u0435 \u0442\u0430\u043c \u0431\u044b\u043b\u0438 <a href=\"https:\/\/www.highload.ru\/siberia\/2019\/abstracts\/5211\">\u0434\u043e\u043a\u043b\u0430\u0434\u043e\u043c<\/a> \u00ab\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043d\u044b\u0435 \u0431\u0430\u0437\u044b Oracle (CDB\/PDB) \u0438 \u0438\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u041f\u041e\u00bb, \u043c\u044b \u0432\u044b\u043b\u043e\u0436\u0438\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0436\u0435. \u0411\u044b\u043b\u043e \u043a\u0440\u0443\u0442\u043e, \u0441\u043f\u0430\u0441\u0438\u0431\u043e <a href=\"https:\/\/habr.com\/ru\/users\/olegbunin\/\" class=\"user_link\">olegbunin<\/a> \u0437\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u043f\u0440\u0438\u0448\u0451\u043b. <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/-7\/k4\/u1\/-7k4u1btcjxquu515qeoyxnxigu.jpeg\" width=\"350\"><\/div>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0441\u0442\u0435\u043d\u0434\u0435, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0432 Oracle. \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u2014 8 \u0437\u0430\u0434\u0430\u0447, \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-292005","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=292005"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292005\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=292005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=292005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=292005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}