Welcome 微信登录

首页 / 数据库 / MySQL / 【PostgreSQL使用教程】PostgreSQL 中的 large object

  1. //主要有下面两个系统表,pg_largeobject_metadata主要记录权限的,有用的只有pg_largeobject   
  2.   
  3.   
  4.   
  5. CATALOG(pg_largeobject_metadata,2995)  
  6. {  
  7.     Oid         lomowner;       /* OID of the largeobject owner */  
  8. #ifdef CATALOG_VARLEN           /* variable-length fields start here */   
  9.     aclitem     lomacl[1];      /* access permissions */  
  10. #endif   
  11. } FormData_pg_largeobject_metadata;  
  12.   
  13. /* 
  14.  * Each "page" (tuple) of a large object can hold this much data 
  15.  * 
  16.  * We could set this as high as BLCKSZ less some overhead, but it seems 
  17.  * better to make it a smaller value, so that not as much space is used 
  18.  * up when a page-tuple is updated.  Note that the value is deliberately 
  19.  * chosen large enough to trigger the tuple toaster, so that we will 
  20.  * attempt to compress page tuples in-line.  (But they won"t be moved off 
  21.  * unless the user creates a toast-table for pg_largeobject...) 
  22.  * 
  23.  * Also, it seems to be a smart move to make the page size be a power of 2, 
  24.  * since clients will often be written to send data in power-of-2 blocks. 
  25.  * This avoids unnecessary tuple updates caused by partial-page writes. 
  26.  */  
  27. #define LOBLKSIZE  (BLCKSZ / 4)   
  28.   
  29. CATALOG(pg_largeobject,2613) BKI_WITHOUT_OIDS  
  30. {  
  31.     Oid         loid;           /* Identifier of large object */  
  32.     int4        pageno;         /* Page number (starting from 0) */  
  33.     /* data has variable length, but we allow direct access; see inv_api.c */  
  34.     bytea       data;           /* Data for page (may be zero-length) */  
  35. } FormData_pg_largeobject;  
所有的大对象全部拆成 LOBLKSIZE  大小,放入 pg_largeobject 之中,通过 loid进行区分, 每个大对象拆分成的各个部分通过 pageno(叫元组序号更合理),进行顺序的关联起来,pageno是通过 要写入的数据offset / LOBLKSIZE  计算的pg的大对象实现的比较简单,并不适合大数据量的使用,会成为系统的瓶颈.MySQL 中explain的用法Oracle基础教程之管理还原数据相关资讯      PostgreSQL  PostgreSQL使用教程 
  • Ubuntu 16.04 下安装 PostgreSQL   (08月14日)
  • PostgreSQL 发布全系安全更新  (02月12日)
  • 使用pg_basebackup搭建PostgreSQL  (12/30/2015 09:00:29)
  • Linux下RPM包方式安装PostgreSQL  (03月04日)
  • PostgreSQL9.5新特性之行级安全性  (01月19日)
  • 利用pgpool实现PostgreSQL的高可用  (12/30/2015 08:54:36)
本文评论 查看全部评论 (1)
表情: 姓名: 字数


评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款