       
 


   -,         .          (),   SQL/NoSQL  (     )    CAP/PACELC.

           .        (TCO).     PostgreSQL.

    ,          .





 

       








            ,     .  -,   ,                .       (SQL)      .     ,         ,    ,         ,      .

 -,    DevOps-        ,   .      ,   NoSQL-,   key-value           .                ,    ,            .

              .                  ,     ,       .

        :

     ,   ,       .

             ,     .

        ,     time-series .

      ,      ,       .

   (CAP, PACELC)       .

    (Total Cost of Ownership, TCO)     .

   PostgreSQL      open source ,     .

             :  ,    (SRE/DevOps),    (DBA)     . ,        ,        .

    ,       .   ,     ,   -.   -      HNSW -     ,      .                  .

         .   ( 12)   .   ( 34)      .   ( 58)    :  ,  ,       .    ,                 .




 1.     


1.1.            ()     .       ,             (latency)     (throughput).

   ,    :

   - (L1, L2, L3):    140  .      ,                (cache locality).

  (RAM, DRAM):      .    .    ,        .   - .      DRAM .

  (NVM/Optane):  ,  ,   DRAM,   (   ).               (commit latency).

  (SSD/NVMe):     .     .  NVMe-   PCIe     SAS/SATA SSD.       :   (seek time)   ,          .

  (HDD)    (LTO):   . HDD     ()        .          (   ),      (Disaster Recovery).

1.2.                  ,         .               (Shared-Nothing Architecture).

         :

Compute Layer ( ):   SQL-,   ,    (JOIN).  stateless (  )    .

Storage Layer ( ):       ,  ,   .

         .     (,     RPC)    .

1.3.           ,    .       .

1.3.1.    (Marshaling)     (, , JSON-)        .

 :  ,    .     (O(1)),       : Offset = Base + (Index * RecordSize).

  (Variable Length):   (VARCHAR), JSON.      (pointers)    (offset directories)   .  PostgreSQL     TOAST (The Oversized-Attribute Storage Technique),     2    .

1.3.2.    ,       .             O(n).

B- (B-trees):  -   .  ,       .  ,     O(log n).         (range queries).

-:    O(1),          .

GiST (Generalized Search Tree)  SP-GiST:   ,   PostgreSQL     (, R-     PostGIS).

GIN (Generalized Inverted Index):  .          (, JSONB,  ).

1.3.3.       (Atomicity)   (Durability)    ACID    .

Write-Ahead Logging (WAL):  ,      (, , )       (WAL-segment)   ,      (fsync)         .

  (Checkpoints):     (dirty pages)     .           WAL,             .           (I/O spikes)      (Recovery Time Objective, RTO).

1.4.           .  SQL    ,      (MVCC)  :

Read Uncommitted (  ):   .   ,     (COMMIT)  .   .

Read Committed (  ):            .    ,     (non-repeatable read)  .

Repeatable Read ( ):     (snapshot),     . ,           .    ,        (PostgreSQL     Serializable).

Serializable ():   .         .         (Serialization Anomalies).        (deadlocks).

            ,       .




 2.      


      ,     ,          .         ,      .

2.1.  ()      ,         ,        .          .

2.1.1.    (TXT, CSV, TSV):  ,     (LF/CRLF).      (delimiter),    (CSV - Comma-Separated Values)   (TSV). : , ,      .    -      . :     O(n),  n -  .    (    )     .       .      -     . Open source :   (Python csv, pandas),    (awk, sed).

2.1.2.    (XLSX, ODS): ZIP-,   XML-,  , ,    .  ODS (OpenDocument Spreadsheet)    ISO/IEC 26300. :   ,  ,     .         . :      (1 048 576   XLSX).           ,    .      XML-   .     . Open source :  openpyxl, pandas ( Python), LibreOffice SDK.

2.1.3.      (JSON, XML, YAML, Avro, Protocol Buffers):   . JSON  YAML   -  . XML -  . Avro  Protocol Buffers (Protobuf) -     . :   ( ).      . JSON  XML     . :

JSON/XML:   (, ),       40200%     .    (  )    .

Protobuf/Avro:      (.proto  .avsc).      . Open source :  libxml2, jansson, protobuf-c, avro-cpp.

2.2.  ()         (),   API   ,   ,     .

2.2.1.   :  .          .          (   ). :   (NTFS, ext4),    IBM IMS. :    ,    (,  ,   BOM). :        . :     --.     (     ).

2.2.2.   :   ,   .     .       (  ). : IDMS (Integrated Data Store), CA Datacom. :




  .


   .

   ,     (https://www.litres.ru/book/georgiy-dimitriadi/kak-vybrat-bazu-dannykh-dlia-raboty-i-doma-74609927/)  .

      Visa, MasterCard, Maestro,    ,   ,     ,  PayPal, WebMoney, ., QIWI ,       .


