PostgreSQL
ã¯ããã« ltreeã¨ã¯ ltreeå ltreeã®æä½ æ´»ç¨æ³ 1. æ¿èªããã¼ã®æ§ç¯ äºåæºå ãã¼ãã«ä½æ ãã¼ã¿è¿½å 2. ãã¼ãã«ã«ç´°ããã¢ã¯ã»ã¹å¶å¾¡ãããã äºåæºå ltreeã®æå¹å ãã¼ãã«ä½æ ããªã·ã¼ä½æ è¡ã»ãã¥ãªãã£ããªã·ã¼ã®æå¹å ããªã·ã¼ã®è¨å® ãã¼â¦
ã¯ããã« äºåæºå ããªã¬ã¼ã使ç¨ããæ¹æ³ è£è¶³ï¼ããªã¬ã¼ã¨é¢æ°ã®ã¿æ¶ãæ¹æ³ ã¾ã¨ã
ã¯ãã㫠復ç¿ï¼PGlite pg-gateway pg-gatewayã¨PGliteãèµ·åãã¦SQLã¯ã©ã¤ã¢ã³ãããæ¥ç¶ãã ã¾ã¨ã
ã¯ããã« PGliteã®æ¦è¦ PGliteã®ç¹å¾´ PGliteã試ã ãã©ã¦ã¶ã§ä½¿ã PGliteã®é度è¨æ¸¬ ã¾ã¨ã ã¯ããã« ããã«ã¡ã¯ï¼ã¨ã³ã¸ãã¢ï¼å¹´ç®ã®TKDSã§ãï¼ ä»åã¯PGliteã«ã¤ãã¦èª¿ã¹ã¦ã¿ã¾ããï¼ æ¦è¦ã»ä½¿ãæ¹ã»é度å®é¨ã»ã¾ã¨ãã®å 容ã§è¨äºã¯æ§æããã¦ãã¾ãã 使â¦
ä»å¹´ãæ©ããã®ã§ããå¹´æ«ã§ãã 大æé¤ãæèããæã«ããæ®æ®µãããã¾ãã«ãã£ã¦ããã°...ãã¨æ¯å¹´å¾æãã¦ãã¾ãã ãããªç§ã¨ã¯éã£ã¦ãPostgreSQLã«ã¯æ®æ®µãããã¼ã¿ããã¾ãã«æé¤ãã¦ãããåªç§ãªãVACUUMãã¨ããæ©è½ãããã¾ãã ãããã´ããã§ãâ¦
ã¤ã³ã¹ãã¼ã« ãªãã¸ã㪠RPMã®ã¤ã³ã¹ãã¼ã« PostgreSQLã®è¨å®å¤æ´ TimescaleDBæ¡å¼µæ©è½ãæå¹ã«ãã åèè³æ
æè¡åºå ±ã®yayawowoã§ãã SQLã§æ¡ä»¶åå²ãç¨ããã«ã¯ãã©ã®ããã«è¨è¿°ããã°è¯ãã§ããããï¼ ä»åã¯ãSELECTæãUPDATEæã§å©ç¨ããæ¡ä»¶åå²æ¹æ³ã¨ãã¦ããCASEå¼ãããç´¹ä»ãã¾ãï¼ CASEå¼ã®ä½¿ãæ¹ãç¿å¾ããã ãããããæå ã§å®è¡å¯è½ãªSQLæä»ãã§è§£èª¬â¦
æè¡åºå ±ã®yayawowoã§ãã çæ§ãSQLãæ¥é ã使ãã§ããããï¼ ä»åã¯ãããã¼ã¿ã追å ãããéã«æ¬ ãããªãINSERTæã®ä½¿ãæ¹ã¨ãããããã®æ¸ç±ããç´¹ä»ãã¾ãã INSERTæã®ä½¿ãæ¹ãç¿å¾ããã ãããããæå ã§å®è¡å¯è½ãªSQLæä»ãã§è§£èª¬ãã¾ãã æ¯éãå®â¦
æè¡åºå ±ã®yayawowoã§ãã SQLã®ä¸ã§ããè¯ãå©ç¨ãããUPDATEæã§ããã ä»åã¯SQLå ¥éç·¨ã¨ãã¾ãã¦ã UPDATEæã®åºæ¬ï½å¿ç¨ããç´¹ä»ãã¾ãï¼ â»æ¬èª¬æã§ã¯ãPostgreSQL 9.6ãå©ç¨ãã¾ãã
æè¡åºå ±ã®yayawowoã§ãã çæ§ãSQLã®DISTINCTã¯ãåç¥ã§ããããï¼ DISTINCTãè¦ãããã¨ã«ãããSQLã®å®è¡çµæãã¨ã¦ãè¦ããããªãã¾ãï¼ æ¬è¨äºã§ã¯ãDISTINCTã®åºæ¬çãªä½¿ãæ¹ãGROUP BYã¨ã®éããªã©ã説æãã¦ããããã¨æãã¾ãã DISTINCTããã¹ã¿â¦
ããã«ã¡ã¯ãnegimixã§ãã ãã¡ã¤ã«ããã¼ã¿ãã¼ã¹ãªã©ãåæã«æ£ãã°ã£ã¦ãããã¼ã¿ããã¼ã¿ãã¼ã¹ã«éç´ãã¦æ´»ç¨ããããªãã¨æ¼ ç¶ã¨æã£ã¦ãã¾ããã åç´ã«ãã¼ã¿ãèªã¿è¾¼ãã§ããã¼ã¿ãã¼ã¹ã«ç»é²ããããã°ã©ã ãä½ãã°ãããã§ãããä»åã¯Embulkã使â¦
TimescaleDBã®ç¹å¾´ TimescaleDBã®æ©è½ã¨ã©ã¤ã»ã³ã¹ TimescaleDBã®éçºç¶æ³ TimescaleDBã®ãã¼ã¿ç®¡ç
ã¯ããã« ããã«ã¡ã¯ã楽楽精ç®éçºãã¼ã ã®yk_itgã§ãã ããã¾ã§6åã®æ稿ã§ä¸»ã«PostgreSQLã«ã¤ãã¦ã®è¨äºãæ¸ãã¦ãã¾ããããä»åã¯PostgreSQLãã¯ããã¨ãããã¼ã¿ãã¼ã¹ã管çããDBMSãããªã¬ã¼ã·ã§ãã«ãã¼ã¿ãã¼ã¹ã管çããRDBMSã«ã¤ãã¦ã¾ã¨ãã¾â¦
ããã«ã¡ã¯ãã¨ã³ã¸ãã¢ã®rs_shoã§ãã æ稿ã¯5åç®ã«ãªãã¾ããä»åã¯åå¿è åãã®SQLã«ã¤ãã¦èª¬æãããã¨æãã¾ãã ã¯ããã« SQLã¨ã¯ åSQLã®å½ä»¤æ ãã¼ã¿ã®æ¤ç´¢(é²è¦§) SELECTæã®æ¸ãæ¹ SELECTæã®ä½¿ç¨æ¹æ³ ãã¼ã¿ã®ç»é²(æ¿å ¥) INSERTæã®æ¸ãæ¹ INSERâ¦
ã¯ããã« ããã«ã¡ã¯ãæ°å1å¹´ç®ã®Hiroto-Kitamuraã§ãã ç§ã®æå±ããé¨ç½²ã§ã¯RDBMS(é¢ä¿ãã¼ã¿ãã¼ã¹ç®¡çã·ã¹ãã )ã«PostgreSQLãæ¡ç¨ãã¦ãããç§ãæ¥ã åå¼·ãè¡ã£ã¦ãã¾ãã ãã®ä¸ã§é£ããæãããã¨ã®1ã¤ããã¿ã¼ããã«ã«æã¡è¾¼ãã³ãã³ãã§ãã RDBMSâ¦
ã¯ããã« ããã«ã¡ã¯ãæ°å1å¹´ç®ã®YoshidaMichaelã§ãã ç§ã®æå±ãã¦ãããã¼ã ã§ã¯1å¹´ç®ã«OSS-DB Silverãåå¾ããã¨ããç®æ¨ãããããã®åº¦ç¡äºåå¾ã«è³ãã¾ããã®ã§ç§ã®è¡ã£ãå¦ç¿æ¹æ³ã¨ãã®æ¯è¼ãä»ã¼ãããå¦ç¿ãé²ãããªããã£ã¨ããã§ãããªãã¨ãã£â¦
ããã«ã¡ã¯ãtakaramã§ãã ç§ãæ å½ãã¦ãããµã¼ãã¹ã§ã¯ãRDBMSã«PostgreSQLãå©ç¨ãã¦ãã¾ããä»åã¯æ¥åã§è¡ã£ããããããã¯ã®èª¿æ»ã§ç¥ã£ããPostgreSQLã®ä»æ§ã«é¢ãã¦æ¸ãã¦ããã¾ãã ããã§ã¯ ããããã㯠ã ãã¼ãã£ã·ã§ãã³ã° ã¨ãã£ãç¨èªãç»â¦
ã¯ããã« ããã«ã¡ã¯ãkkystã§ãã éçºãæ å½ãã¦ãããããã¯ãã§ã¯pg_bigmãå©ç¨ãã¦å ¨ææ¤ç´¢æ©è½ãæä¾ãã¦ãã¾ãã ä»åããã®å ¨ææ¤ç´¢ãè¡ã£ã¦ãããã¼ãã«ã«INSERTãè¡ãä¸é¨ã®å¦çã§ãå¿çæéãå¢ãã¦ãããã¨ãæ¤ç¥ãã¾ããã ããã§ãã®åå ã調â¦
ã¯ããã« ããã«ã¡ã¯ãyk_itgã§ãã ããã¾ã§ããã¤ãPostgreSQLã®è¨äºãä½æãã¾ããããä»åã¯ç¥ã£ã¦ããã¨ä¾¿å©ã ã¨æããã¼ãã«ã»DBã®é²è¦§ã»ã³ãã¼ã«é¢ããtipsãã¾ã¨ãã¦ã¿ã¾ããã ç§ã¯ãã¹ããå®æ½ããæã«çµæã確èªãããããã¼ã¿ãç¨æããéã«ããâ¦
ã¯ããã« ããã«ã¡ã¯ãæ°å3å¹´ç®ã®choreii ã§ãã ä»åã¯PostgreSQLã®å®è¡è¨ç»ã«ã¤ãã¦è¨äºãæ¸ããã¨æãã¾ãã ç§ãåãã¦å®è¡è¨ç»ã«ã¤ãã¦ç¥ã£ãæã¯é£ããããªã¤ã¡ã¼ã¸ãå è¡ãã¦ãããå®éã«èª¿ã¹ã¦ã¿ã¦ãæ å ±éãå¤ããã¼ãã«ãé«ãã£ãã§ããã§ãã調â¦
ã¯ããã« ããã«ã¡ã¯ãæ°åï¼å¹´ç®ã«ãªãã¾ããtaku_76ã§ãã ä»åã¯SQLã«ã¤ãã¦ã®è¨äºãæ¸ããã¨æãã¾ãããã®çµç·¯ã¨ãã¦ã¯ãæ¥åã§SQLãå°ãæ¸ããã¨ã¯ãã£ãã®ã§ããã å¿ è¦ãªæ å ±ãåãåºããããããããããã®æèãããªãããã¾ãããã©ã¼ãã³ã¹é¢ãâ¦
ããã«ã¡ã¯ãæ°å1å¹´ç®ã®takaramã§ããã¾ããªãå ¥ç¤¾ãã¦ä¸¸ä¸å¹´ã¨ãªããã»ã¨ãã©çµé¨ã®ãªãã£ãSQLã®åãã¤ãã¦ããã¨æã£ã¦ãã¾ãã ããããããã©ã¼ãã³ã¹é¢ãèæ ®ããSQLã¨ãªãã¨ãã¾ã ã¾ã ç¥èã足ããªãã¨æãã¦ãã¾ãã ç¹ã«ãä¸å¯¾å¤ã®é¢é£ãã¼ãã«ã®â¦
æ°å2å¹´ç®ã®yk_itgã§ããæ©ããã®ã§ç¤¾ä¼äºº2å¹´ç®ãæ®ã1ã¶æã¨ãªãã¾ããã ããã©ã¼ãã³ã¹ãã¥ã¼ãã³ã°ã®éçºãããéã«ãindexã¯ã©ã®ãããªã«ã©ã ã«è²¼ãã®ãè¯ãã®ãæ°ã«ãªã£ãã®ã§ãä»åã¯ããã§èª¿ã¹ããã¨ãæ¸ãã¦ã¿ã¾ãã PostgreSQLã®ãã¼ã¸ã§ã³ï¼ 11.5â¦
ã¯ããã« ããã«ã¡ã¯ãæ°å2å¹´ç®ã®yk_itgã§ãã æ¥åã®ä¸ã§å 容ãåã大éã®ãã¹ããã¼ã¿ãå¿ è¦ãªãã¹ãããã£ãã®ã§ãããæä½æ¥ã§ä½æããã¨ããããã®æé ãè¸ã¾ãªãã¦ã¯ãªããªãã£ãããå ¥åãééããããã¦å¤§å¤ãªã®ã§ããªãã¨ãSQLã§ã§ããªããèãã¦â¦
ããã«ã¡ã¯ãæè¿ãä½åç¶æã®ç®çã§çãã¬ãå§ããbadaikiã§ãã å æ¥ãæ¥åã§PostgreSQLã®ãã¼ãã«ãµã¤ãºã調æ»ãããã¨ããããPostgreSQLã®ä»æ§ã®ç解ãä¸è¶³ãã¦ããã¨å®æãã¾ãããä»åã¯ãã®ãã¨ã«ã¤ãã¦åå¿é²çã«æ¸ãã¦ãããã¨æãã¾ãã ã¯ããã«â¦
ããã«ã¡ã¯ 楽楽æç´°éçºèª²ã®sts-250rrã§ãã å æ¥Postgres11ã®å ¥ã£ãæ¤è¨¼ç°å¢ã«ãç¾å¨éç¨ä¸ã®ç°å¢ã®ãã¼ã¿ã移è¡ãã¦æ¤è¨¼ãããã¨ããæ©ä¼ãããã¾ããã ä½ç¹ãæå¤ã¨ããããããªãããªã¨ãããã¤ã³ããããã¾ããã®ã§ãTry&Errorã®å 容ãã¾ã¨ãã¦ãããâ¦
ã¯ããã« ããã«ã¡ã¯ã2å¹´ç®ã«ãªã£ãyk_itgã§ãã ä»åã¯postgreSQLã§indexãå©ç¨ããæãã©ãã ãæ¤ç´¢é度ãä¸ããã®ã調ã¹ã¦ã¿ããâ¦ã¨ããã®ã§ããããã¾ãindexã使ã£ã¦ãããã¾ããã§ãããä»åã¯ãã®æã®ãã¨ãè¨äºã«ãããã¨æãã¾ãã ãªãããã®è¨äºâ¦
ããã«ã¡ã¯ãMasaKuã§ãã å æ¥ãPostgreSQLã®éç¨ç¥èå¦ç¿ã¨ãã¦ä»¥ä¸ã®æ¸ç±ãèªã¿ã¾ããã gihyo.jp æ¸ç±å ã§ç´¹ä»ããã¦ããããã¼ãã£ã·ã§ãã³ã°ãã«ã¤ãã¦ãå ¬å¼ããã¥ã¡ã³ãã«è¨è¼ããã¦ããå 容ã¨ç §ããåããã¦ãã©ã®ãããªã±ã¼ã¹ã§ããã°ããã©ã¼ãã³â¦
ã¯ããã« ããã«ã¡ã¯ãæ°åã§å ¥ç¤¾ãã¦3å¹´ç®ã®north_mkyã§ãã æè¿æ¥åã§SQLãã¥ã¼ãã³ã°ãããæ©ä¼ããã£ãã®ã§ãå®è¡è¨ç»ãèªã¿è§£ãè¨äºãæ¸ããï¼...ã¨æããã£ãã®ã§ãããè¨äºãæ¸ãã«ããã£ã¦ãµã¼ãã¹ã®ãã¼ã¿ãã¼ã¹ã使ãããã«ã¯ãã¡ãããããªãã®â¦
åãã« ããã«ã¡ã¯ï¼ã¨ã³ã¸ãã¢ã®id:FM_Harmonyã§ãã ååã¯gitã®fetchã³ãã³ãã«ã¤ãã¦ãè¨äºãæ稿ãã¾ããã tech-blog.rakus.co.jp ä»åã¯postgreSQLã®å¯¾è©±åã¿ã¼ããã«ãpsqlã®ãªãã·ã§ã³ã«ã¤ãã¦ç´¹ä»ãããã¨æãã¾ãã æ®æ®µã®æ¥åã§ããpsqlã³ãã³ãâ¦