pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    • <bdo id='WoDNB'></bdo><ul id='WoDNB'></ul>
    <i id='WoDNB'><tr id='WoDNB'><dt id='WoDNB'><q id='WoDNB'><span id='WoDNB'><b id='WoDNB'><form id='WoDNB'><ins id='WoDNB'></ins><ul id='WoDNB'></ul><sub id='WoDNB'></sub></form><legend id='WoDNB'></legend><bdo id='WoDNB'><pre id='WoDNB'><center id='WoDNB'></center></pre></bdo></b><th id='WoDNB'></th></span></q></dt></tr></i><div class="ln7tbnb" id='WoDNB'><tfoot id='WoDNB'></tfoot><dl id='WoDNB'><fieldset id='WoDNB'></fieldset></dl></div>

    <small id='WoDNB'></small><noframes id='WoDNB'>

        <legend id='WoDNB'><style id='WoDNB'><dir id='WoDNB'><q id='WoDNB'></q></dir></style></legend>
      1. <tfoot id='WoDNB'></tfoot>
      2. 了解 MyISAM 記錄結構

        Understanding MyISAM record structure(了解 MyISAM 記錄結構)
        <i id='IEDFk'><tr id='IEDFk'><dt id='IEDFk'><q id='IEDFk'><span id='IEDFk'><b id='IEDFk'><form id='IEDFk'><ins id='IEDFk'></ins><ul id='IEDFk'></ul><sub id='IEDFk'></sub></form><legend id='IEDFk'></legend><bdo id='IEDFk'><pre id='IEDFk'><center id='IEDFk'></center></pre></bdo></b><th id='IEDFk'></th></span></q></dt></tr></i><div class="vtnbj5d" id='IEDFk'><tfoot id='IEDFk'></tfoot><dl id='IEDFk'><fieldset id='IEDFk'></fieldset></dl></div>

          <legend id='IEDFk'><style id='IEDFk'><dir id='IEDFk'><q id='IEDFk'></q></dir></style></legend>
              <tbody id='IEDFk'></tbody>
              • <bdo id='IEDFk'></bdo><ul id='IEDFk'></ul>

                <small id='IEDFk'></small><noframes id='IEDFk'>

                  <tfoot id='IEDFk'></tfoot>

                1. 本文介紹了了解 MyISAM 記錄結構的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我試圖了解 MyISAM 如何物理存儲其記錄以及在記錄插入和記錄刪除后如何維護其結構.我已閱讀以下鏈接:

                  • 第 10 章:存儲引擎"第196頁第7段說

                    <塊引用>

                    對于可變長度的記錄,格式更復雜.第一個字節包含描述記錄子類型的特殊代碼.后續字節的含義因每個子類型而異,但共同的主題是有一個字節序列,其中包含記錄的長度、塊中未使用的字節數、NULL 值指示符標志以及可能的指向如果記錄不適合先前創建的空間并且必須拆分,則記錄的延續.當一條記錄被刪除,并且要插入其位置的新記錄超過原始記錄的大小時,就會發生這種情況.可以通過研究storage/myisam/mi_dynrec.c中的switch語句in_mi_get_block_info()得到不同代碼含義的詳細信息.

                    基于該段落,只有當要插入的新數據無法放入先前分配的塊時,舊記錄才會被鏈接數據覆蓋.這可能會導致許多臃腫的行.

                    附加問題

                    <塊引用>

                    如果表被多次刪除和插入,是否會非常低效,因為記錄結構可能充滿溢出指針和未使用的空間?

                    根據我之前的回答,會有很多塊

                    • 空間塊
                    • 記錄長度
                    • 塊中未使用的字節數
                    • NULL 值指示符標志
                    • 如果記錄不適合先前創建的空間并且必須拆分,則可能是指向記錄延續的指針

                    此類記錄鏈接將從插入過大數據的每一行的前面開始.這會很快使 MyISAM 表 .MYD 文件膨脹.

                    建議

                    MyISAM 的默認行格式是動態的.當一個表是動態的并且經歷了很多 INSERT、UPDATE 和 DELETE 時,這樣的表需要使用

                    進行優化

                    優化表mytable;

                    還有一種選擇:將表格的行格式切換為固定.這樣,所有行的大小都相同.這是使行格式固定的方式:

                    ALTER TABLE mytable ROW_FORMAT=Fixed;

                    即使使用固定行格式,也必須花費時間來定位可用記錄,但時間將是 O(1) 搜索時間(通俗地說,無論定位可用記錄,都需要相同的時間表有多少行或有多少已刪除的行).您可以通過啟用 來繞過該步驟concurrent_insert 如下:

                    將此添加到 my.cnf

                    [mysqld]并發插入 = 2

                    不需要重啟 MySQL.就跑

                    mysql>SET GLOBAL concurrent_insert = 2;

                    這將導致所有 INSERT 都轉到表的后面而不尋找可用空間.

                    固定行表的優勢

                    • INSERT、UPDATE 和 DELETE 會更快一些
                    • SELECT 速度提高了 20-25%

                    這是我關于 SELECT 因行格式固定而更快的一些帖子

                    • 2012 年 5 月 3 日:InnoDB 和 MyISAM 哪個更快?
                    • 2011 年 9 月 20 日:最佳MyISAM 和 InnoDB
                    • 2011 年 5 月 10 日:在固定設備上使用 CHAR 與 VARCHAR 對性能有何影響?-size 字段?

                    Fixed Row 表的缺點

                    在大多數情況下,當您運行 ALTER TABLE mytable ROW_FORMAT=Fixed; 時,表可能會增長 80-100%..MYI 文件(MyISAM 表的索引頁)也將以相同的速度增長.

                    結語

                    如果您想要 MyISAM 表的速度并且可以使用更大的表,則需要我的替代建議.如果要為每個 MyISAM 表節省空間,請保留行格式(動態).您將不得不使用 OPTIMIZE TABLE mytable; 更頻繁地使用動態表來壓縮表.

                    I am trying to understand how MyISAM physically store its records and how it maintains its structure after record insertion and record deletion. I have read the following link:

                    • MyISAM Dynamic Data File Layout
                    • MyISAM Record Structure

                    I want to make sure if I understand it correctly, please correct me if it is not right.

                    Fixed-sized record

                    • Delete marker determines whether record is deleted or not deleted.
                    • Record header holds which column of a row contains NULL value
                    • The length of data is fixed.

                    Variable-sized record

                    • Delete marker is replaced with BLOCK_DELETED block type
                    • Record header holds length of data and length of unused data

                    • A single record can be seperated into multiple block connected by overflow pointer.

                    Deletion

                    • For variable-sized record, change block type to BLOCK_DELETED
                    • Maintain double linked-list of all deleted record by having the previous pointer of the newly deleted record points to last deleted record. Then, the last deleted record's next pointer points to the newly deleted record.
                    • For fixed-sized record, simply change delete marker as deleted. (unsure if they use double linked-list to connect all the deleted record with fixed-sized record)

                    Insertion

                    • If there is no unused space (deleted records), append the data at the end of the file
                    • If there is unused space that fits the newly inserted record, write the new record there.
                    • If there is unused space that is far bigger than newly inserted record, split into two records: the new record and the deleted record.
                    • If there is unused space that is smaller than newly inserted record, write data there, have overflow pointer to points to the unfitted data at other block.

                    Updating

                    • What if users update existed data with longer data? Will MyISAM marked the record as deleted and find place that fits the new data or simply use overflow pointer to point to unfitted data?

                    Recap the question again

                    I want to make sure if I understand it correctly, please correct me if it is not right.

                    Additional questions

                    • Would it be very inefficient if the table has been deleted and inserted for many times since the record structure could potentially full of overflow pointers and unused space?

                    解決方案

                    The information you have in the question concerning MyISAM is right on target. However, I would like to address your two additional questions:

                    LATEST QUESTION

                    What if users update existed data with longer data? Will MyISAM marked the record as deleted and find place that fits the new data or simply use overflow pointer to point to unfitted data?

                    According to the Book

                    Chapter 10 : "Storage Engines" Page 196 Paragraph 7 says

                    For records with variable length, the format is more complicated. The first byte contains a special code describing the subtype of the record. The meaning of the subsequent bytes varies with each subtype, but the common theme is that there is a sequence of bytes that contains the length of the record, the number of unused bytes in the block, NULL value indicator flags, and possibly a pointer to the continuation of the record if the record did not fit into the previously created space and had to be split up. This can happen when one record gets deleted, and a new one to be inserted into its place exceeds the original one is size. You can get the details of the meanings of different codes by studying the switch statement in_mi_get_block_info() in storage/myisam/mi_dynrec.c.

                    Based on that paragraph, the old record gets overwritten with linkage data only if the new data to insert cannot fit in the previously allocated block. This can result in many bloated rows.

                    ADDITIONAL QUESTION

                    Would it be very inefficient if the table has been deleted and inserted for many times since the record structure could potentially full of overflow pointers and unused space?

                    From my previous answer, there would be lots of blocks that have

                    • block of space
                    • the length of the record
                    • the number of unused bytes in the block
                    • NULL value indicator flags
                    • possibly a pointer to the continuation of the record if the record did not fit into the previously created space and had to be split up

                    Such record links would start in the front of every row that have oversized data being inserted. This can bloat a MyISAM tables .MYD file very quickly.

                    SUGGESTIONS

                    The default row format of a MyISAM is Dynamic. When a table is Dynamic and experiences lots of INSERTs, UPDATEs, and DELETEs, such a table would need to optimized with

                    OPTIMIZE TABLE mytable;
                    

                    There is an alternative: switch the table's row format to Fixed. That way, all rows are the same size. This is how you make the row format Fixed:

                    ALTER TABLE mytable ROW_FORMAT=Fixed;
                    

                    Even with a Fixed Row Format, time must be taken to locate an available record but the time would be O(1) search time (In layman's terms, it would take the same amount of time to locate an available record no matter how many rows the table has or how many deleted rows there are). You could bypass that step by enabling concurrent_insert as follows:

                    Add this to my.cnf

                    [mysqld]
                    concurrent_insert = 2
                    

                    MySQL restart not required. Just run

                    mysql> SET GLOBAL concurrent_insert = 2;
                    

                    This would cause all INSERTs to go to the back of the table without looking for free space.

                    Advantage of Fixed Row tables

                    • INSERTs, UPDATEs, and DELETEs would be somewhat faster
                    • SELECT are 20-25% faster

                    Here are some of my posts on SELECT being faster for Row Formats being Fixed

                    • May 03, 2012 : Which is faster, InnoDB or MyISAM?
                    • Sep 20, 2011 : Best of MyISAM and InnoDB
                    • May 10, 2011 : What is the performance impact of using CHAR vs VARCHAR on a fixed-size field?

                    Disadvantage of Fixed Row tables

                    In most cases, when you run ALTER TABLE mytable ROW_FORMAT=Fixed;, the table may grow 80-100%. The .MYI file (index pages for the MyISAM table) would also grow at the same rate.

                    EPILOGUE

                    If you want speed for MyISAM tables and can live with bigger tables, my alternate suggestions would be needed. If you want to conserve space for each MyISAM table, leave the row format as is (Dynamic). You will have to compress the table with OPTIMIZE TABLE mytable; more frequent with Dynamic tables.

                    這篇關于了解 MyISAM 記錄結構的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                    【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 N 個先前值來決定接下來的 N 個行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環數組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數據庫表作為 Spark 數據幀讀取?)

                    <tfoot id='QzQRv'></tfoot>
                        <bdo id='QzQRv'></bdo><ul id='QzQRv'></ul>

                        • <legend id='QzQRv'><style id='QzQRv'><dir id='QzQRv'><q id='QzQRv'></q></dir></style></legend>
                          <i id='QzQRv'><tr id='QzQRv'><dt id='QzQRv'><q id='QzQRv'><span id='QzQRv'><b id='QzQRv'><form id='QzQRv'><ins id='QzQRv'></ins><ul id='QzQRv'></ul><sub id='QzQRv'></sub></form><legend id='QzQRv'></legend><bdo id='QzQRv'><pre id='QzQRv'><center id='QzQRv'></center></pre></bdo></b><th id='QzQRv'></th></span></q></dt></tr></i><div class="r59j9pr" id='QzQRv'><tfoot id='QzQRv'></tfoot><dl id='QzQRv'><fieldset id='QzQRv'></fieldset></dl></div>
                              <tbody id='QzQRv'></tbody>
                          • <small id='QzQRv'></small><noframes id='QzQRv'>

                            主站蜘蛛池模板: 无缝钢管-聊城无缝钢管-小口径无缝钢管-大口径无缝钢管 - 聊城宽达钢管有限公司 | 外贸资讯网 - 洞悉全球贸易,把握市场先机 | 丝印油墨_水性油墨_环保油墨油漆厂家_37国际化工 | MES系统-WMS系统-MES定制开发-制造执行MES解决方案-罗浮云计算 | 浴室柜-浴室镜厂家-YINAISI · 意大利设计师品牌 | 咿耐斯 |-浙江台州市丰源卫浴有限公司 | 不锈钢反应釜,不锈钢反应釜厂家-价格-威海鑫泰化工机械有限公司 不干胶标签-不干胶贴纸-不干胶标签定制-不干胶标签印刷厂-弗雷曼纸业(苏州)有限公司 | 英国公司注册-新加坡公司注册-香港公司开户-离岸公司账户-杭州商标注册-杭州优创企业 | 塑胶地板-商用PVC地板-pvc地板革-安耐宝pvc塑胶地板厂家 | 深圳货架厂家_金丽声精品货架_广东金丽声展示设备有限公司官网 | 北京遮阳网-防尘盖土网-盖土草坪-迷彩网-防尘网生产厂家-京兴科技 | AGV无人叉车_激光叉车AGV_仓储AGV小车_AGV无人搬运车-南昌IKV机器人有限公司[官网] | 高速混合机_锂电混合机_VC高效混合机-无锡鑫海干燥粉体设备有限公司 | 送料机_高速冲床送料机_NC伺服滚轮送料机厂家-东莞市久谐自动化设备有限公司 | 胶泥瓷砖胶,轻质粉刷石膏,嵌缝石膏厂家,腻子粉批发,永康家德兴,永康市家德兴建材厂 | 防爆鼓风机-全风-宏丰鼓风机-上海梁瑾机电设备有限公司 | 全自动烧卖机厂家_饺子机_烧麦机价格_小笼汤包机_宁波江北阜欣食品机械有限公司 | 冷凝水循环试验箱-冷凝水试验箱-可编程高低温试验箱厂家-上海巨为(www.juweigroup.com) | 安全,主动,被动,柔性,山体滑坡,sns,钢丝绳,边坡,防护网,护栏网,围栏,栏杆,栅栏,厂家 - 护栏网防护网生产厂家 | b2b网站大全,b2b网站排名,找b2b网站就上地球网 | 真空包装机-诸城市坤泰食品机械有限公司 | 考勤系统_人事考勤管理系统_本地部署BS考勤系统_考勤软件_天时考勤管理专家 | 减速机三参数组合探头|TSM803|壁挂式氧化锆分析仪探头-安徽鹏宸电气有限公司 | 无菌实验室规划装修设计-一体化实验室承包-北京洁净净化工程建设施工-北京航天科恩实验室装备工程技术有限公司 | 工业PH计|工业ph酸度计|在线PH计价格-合肥卓尔仪器仪表有限公司 济南画室培训-美术高考培训-山东艺霖艺术培训画室 | 南京办公用品网-办公文具用品批发-打印机耗材采购 | 劳动法网-专业的劳动法和劳动争议仲裁服务网 | 【德信自动化】点胶机_全自动点胶机_自动点胶机厂家_塑料热压机_自动螺丝机-深圳市德信自动化设备有限公司 | 生物除臭剂-除味剂-植物-污水除臭剂厂家-携葵环保有限公司 | 作文导航网_作文之家_满分作文_优秀作文_作文大全_作文素材_最新作文分享发布平台 | 苏州教学设备-化工教学设备-环境工程教学模型|同科教仪 | 专业的新乡振动筛厂家-振动筛品质保障-环保振动筛价格—新乡市德科筛分机械有限公司 | 标准件-非标紧固件-不锈钢螺栓-非标不锈钢螺丝-非标螺母厂家-三角牙锁紧自攻-南京宝宇标准件有限公司 | 骨密度仪-骨密度测定仪-超声骨密度仪-骨龄测定仪-天津开发区圣鸿医疗器械有限公司 | 气弹簧定制-气动杆-可控气弹簧-不锈钢阻尼器-工业气弹簧-可调节气弹簧厂家-常州巨腾气弹簧供应商 | 阁楼货架_阁楼平台_仓库仓储设备_重型货架_广州金铁牛货架厂 | 环压强度试验机-拉链拉力试验机-上海倾技仪器仪表科技有限公司 | 铝机箱_铝外壳加工_铝外壳厂家_CNC散热器加工-惠州市铂源五金制品有限公司 | 环讯传媒,永康网络公司,永康网站建设,永康小程序开发制作,永康网站制作,武义网页设计,金华地区网站SEO优化推广 - 永康市环讯电子商务有限公司 | 锂电池生产厂家-电动自行车航模无人机锂电池定制-世豹新能源 | 贵州自考_贵州自学考试网 | 不锈钢/气体/液体玻璃转子流量计(防腐,选型,规格)-常州天晟热工仪表有限公司【官网】 |