{"id":4380,"date":"2016-06-24T14:18:22","date_gmt":"2016-06-24T05:18:22","guid":{"rendered":"http:\/\/www.lancard.com\/blog\/?p=4380"},"modified":"2025-03-12T11:27:07","modified_gmt":"2025-03-12T02:27:07","slug":"postgresql8-1%e3%81%a72%e3%82%ab%e3%83%a9%e3%83%a0%e3%81%ae%e6%97%a5%e4%bb%98%e6%a4%9c%e7%b4%a2%e3%81%ab%e3%82%a4%e3%83%b3%e3%83%87%e3%83%83%e3%82%af%e3%82%b9%e3%82%92%e4%bd%bf%e3%81%86","status":"publish","type":"post","link":"https:\/\/www.lancard.com\/blog\/2016\/06\/24\/postgresql8-1%e3%81%a72%e3%82%ab%e3%83%a9%e3%83%a0%e3%81%ae%e6%97%a5%e4%bb%98%e6%a4%9c%e7%b4%a2%e3%81%ab%e3%82%a4%e3%83%b3%e3%83%87%e3%83%83%e3%82%af%e3%82%b9%e3%82%92%e4%bd%bf%e3%81%86\/","title":{"rendered":"PostgreSQL8.1\u30672\u30ab\u30e9\u30e0\u306e\u65e5\u4ed8\u691c\u7d22\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u3046"},"content":{"rendered":"<p>RHEL5\u7cfb\u3001\u307e\u3060\u307e\u3060\u73fe\u5f79\u3067\u3059\u30022020\u5e74\u307e\u3067\u3002<\/p>\n<p>\u958b\u59cb\u65e5\u3068\u7d42\u4e86\u65e5\u306e\u6709\u308b\u30c6\u30fc\u30d6\u30eb\u3067\u3001\u300c\u4eca\u65e5\u300d\u304c\u3053\u306e\u671f\u9593\u5185\u306b\u6709\u308b\u30c7\u30fc\u30bf\u3092\u691c\u7d22\u3059\u308b\u5834\u5408\u3001\u958b\u59cb\u65e5\u3068\u7d42\u4e86\u65e5\u3067\u500b\u5225\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u8cbc\u308b\u4e8b\u306b\u306a\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u6975\u7aef\u306b\u904e\u53bb\u3084\u672a\u6765\u306e\u30c7\u30fc\u30bf\u304c\u591a\u304f\u306a\u3063\u305f\u308a\u3059\u308b\u3068\u3001\u7247\u65b9\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u7121\u99c4\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\nbtree\u3067\u8907\u6570\u5217\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f5c\u3063\u3066\u3082\u3001\u305d\u306e\u307e\u307e\u3067\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u3063\u3066\u304f\u308c\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u304b\u306a\u308a\u306d\u3058\u3063\u305f\u65b9\u5411\u3067\u51fa\u6765\u307e\u3057\u305f\u3002<\/p>\n<p><!--more--><\/p>\n<pre lang=\"sql\">\nCREATE INDEX test_index ON tb\nusing btree(\n  (EXTRACT(EPOCH FROM date_st)::int8),\n  (EXTRACT(EPOCH FROM date_ed)::int8)\n);\n<\/pre>\n<pre lang=\"sql\">\nEXPLAIN SELECT * FROM tb\n WHERE EXTRACT(EPOCH FROM date 'today')::int8\n BETWEEN EXTRACT(EPOCH FROM date_st)::int8 AND EXTRACT(EPOCH FROM date_ed)::int8\n ;\n<\/pre>\n<p>\u7d50\u679c\u306f\u3053\u3093\u306a\u611f\u3058\u3067Bitmap Index\u3092\u4f7f\u3063\u3066\u304f\u308c\u307e\u3057\u305f\u3002<\/p>\n<pre lang=\"sql\">\nBitmap Heap Scan on tb  (cost=311.24..15402.21 rows=10457 width=524)\n  Recheck Cond: ((1466694000::bigint >= (date_part('epoch'::text, (date_st)::timestamp without time zone))::bigint) AND (1466694000::bigint <= (date_part('epoch'::text, (date_ed)::timestamp without time zone))::bigint))\n  ->  Bitmap Index Scan on test_index  (cost=0.00..311.24 rows=10457 width=0)\n        Index Cond: ((1466694000::bigint >= (date_part('epoch'::text, (date_st)::timestamp without time zone))::bigint) AND (1466694000::bigint <= (date_part('epoch'::text, (date_ed)::timestamp without time zone))::bigint))\n<\/pre>\n<p>\u3044\u3084\u3001\u3067\u3082\u5b9f\u969b8.4\u306a\u3089\u4e0b\u307f\u305f\u3044\u306bINDEX \u306bDESC\u5165\u308c\u308b\u3068BETWEEN\u3067\u666e\u901a\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u4f7f\u3063\u3066\u304f\u308c\u308b\u3089\u3057\u3044\u3093\u3067\u3001\u3042\u3093\u307e\u5f79\u306b\u7acb\u305f\u306a\u3044\u3093\u3067\u3059\u3051\u3069\u3002<\/p>\n<pre lang=\"sql\">\nCREATE INDEX test_index on tb using btree(date_st, date_ed DESC);\nSELECT * FROM tb WHERE date 'today' BETWEEN date_st AND date_ed;\n<\/pre>\n<p>\u7bc4\u56f2\u578b\u304c\u307e\u3060\u7121\u3044\u3093\u3067\u3001\u3061\u3087\u3063\u3068\u9762\u5012\u306a\u306e\u306f\u5909\u308f\u3089\u305a\u3002<br \/>\n\u3082\u3063\u3068\u7c21\u5358\u306b\u5b9f\u73fe\u51fa\u6765\u305d\u3046\u306a\u3089\u3001\u3053\u3063\u305d\u308a\u6559\u3048\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-facebook nolightbox\" data-provider=\"facebook\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Facebook\" href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F4380&amp;t=PostgreSQL8.1%E3%81%A72%E3%82%AB%E3%83%A9%E3%83%A0%E3%81%AE%E6%97%A5%E4%BB%98%E6%A4%9C%E7%B4%A2%E3%81%AB%E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9%E3%82%92%E4%BD%BF%E3%81%86&amp;s=100&amp;p[url]=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F4380&amp;p[images][0]=&amp;p[title]=PostgreSQL8.1%E3%81%A72%E3%82%AB%E3%83%A9%E3%83%A0%E3%81%AE%E6%97%A5%E4%BB%98%E6%A4%9C%E7%B4%A2%E3%81%AB%E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9%E3%82%92%E4%BD%BF%E3%81%86\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"Facebook\" title=\"Share on Facebook\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/facebook.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-twitter nolightbox\" data-provider=\"twitter\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Twitter\" href=\"http:\/\/twitter.com\/share?url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F4380&amp;text=PostgreSQL8.1%E3%81%A72%E3%82%AB%E3%83%A9%E3%83%A0%E3%81%AE%E6%97%A5%E4%BB%98%E6%A4%9C%E7%B4%A2%E3%81%AB%E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9%E3%82%92%E4%BD%BF%E3%81%86\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"twitter\" title=\"Share on Twitter\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/twitter.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-linkedin nolightbox\" data-provider=\"linkedin\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Linkedin\" href=\"https:\/\/www.linkedin.com\/shareArticle?mini=true&amp;url=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F4380&amp;title=PostgreSQL8.1%E3%81%A72%E3%82%AB%E3%83%A9%E3%83%A0%E3%81%AE%E6%97%A5%E4%BB%98%E6%A4%9C%E7%B4%A2%E3%81%AB%E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9%E3%82%92%E4%BD%BF%E3%81%86\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"linkedin\" title=\"Share on Linkedin\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/linkedin.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-tumblr nolightbox\" data-provider=\"tumblr\" target=\"_blank\" rel=\"nofollow\" title=\"Share on tumblr\" href=\"https:\/\/tumblr.com\/share?s=&amp;v=3&amp;t=PostgreSQL8.1%E3%81%A72%E3%82%AB%E3%83%A9%E3%83%A0%E3%81%AE%E6%97%A5%E4%BB%98%E6%A4%9C%E7%B4%A2%E3%81%AB%E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9%E3%82%92%E4%BD%BF%E3%81%86&amp;u=https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F4380\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"tumblr\" title=\"Share on tumblr\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/tumblr.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-mail nolightbox\" data-provider=\"mail\" rel=\"nofollow\" title=\"Share by email\" href=\"mailto:?subject=PostgreSQL8.1%E3%81%A72%E3%82%AB%E3%83%A9%E3%83%A0%E3%81%AE%E6%97%A5%E4%BB%98%E6%A4%9C%E7%B4%A2%E3%81%AB%E3%82%A4%E3%83%B3%E3%83%87%E3%83%83%E3%82%AF%E3%82%B9%E3%82%92%E4%BD%BF%E3%81%86&amp;body=%E3%82%B7%E3%82%A7%E3%82%A2%E3%81%99%E3%82%8B%EF%BC%9A:%20https%3A%2F%2Fwww.lancard.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F4380\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"mail\" title=\"Share by email\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/www.lancard.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/mail.png\" \/><\/a>","protected":false},"excerpt":{"rendered":"<p>RHEL5\u7cfb\u3001\u307e\u3060\u307e\u3060\u73fe\u5f79\u3067\u3059\u30022020\u5e74\u307e\u3067\u3002 \u958b\u59cb\u65e5\u3068\u7d42\u4e86\u65e5\u306e\u6709\u308b\u30c6\u30fc\u30d6\u30eb\u3067\u3001\u300c\u4eca\u65e5\u300d\u304c\u3053\u306e\u671f\u9593\u5185\u306b\u6709\u308b\u30c7\u30fc\u30bf\u3092\u691c\u7d22\u3059\u308b\u5834\u5408\u3001\u958b\u59cb\u65e5\u3068\u7d42\u4e86\u65e5\u3067\u500b\u5225\u306b\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u8cbc\u308b\u4e8b\u306b\u306a\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u6975\u7aef\u306b\u904e\u53bb\u3084\u672a\u6765\u306e\u30c7\u30fc\u30bf\u304c [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4380","post","type-post","status-publish","format-standard","hentry","category-1"],"_links":{"self":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/4380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/comments?post=4380"}],"version-history":[{"count":8,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/4380\/revisions"}],"predecessor-version":[{"id":4388,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/posts\/4380\/revisions\/4388"}],"wp:attachment":[{"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/media?parent=4380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/categories?post=4380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lancard.com\/blog\/wp-json\/wp\/v2\/tags?post=4380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}