- PostgreSQLカンファレンス 2021 - チュートリアル - https://www.postgresql.jp/jpug-pgcon2021 - 詳細はこちら https://github.com/soudai/pgcon21j-tutorial

Redshiftにおいて、DBユーザ向けに、あるスキーマ内にあるオブジェクト(tableとかviewとか)に対する権限を付与しようとした場合、今まで以下のSQLを利用していました。 GRANT SELECT ON ALL TABLES IN SCHEMA schema_name TO GROUP db_user_group; しかし、このSQLでは このGrant文を実行した後に作成したテーブルには、権限が反映されない という問題があります。(あります、というか、そんな事知らずに運用していました。。。) この事を考慮して ALTER DEFAULT PRIVILEGES文 を利用すべきとなります。これは、PostgreSQL 9.0から利用できる機能で、Redshiftでも利用できます。公式ドキュメントはこちらです。 ALTER DEFAULT PRIVILEGES - Amazon Re
trdsqlというコマンドラインツールを作りました。 Goで作ってます。 githubの trdsqlからダウンロード出来ます。 またLinux/Windows/macOSのバイナリもあります。 以下は、古くなっている内容もいくつかあります。 最新版に対応した、より詳細な内容は trdsql 目次 | Noboru Saito's page を参照して下さい。 これは何? 簡単に言えばCSV(TSV含む)やLTSVに対してSQLを実行できるツールです。 同様のツールが q や textql 等いくつかあります。 trdsqlはPostgreSQLドライバとMySQLドライバを含んでいて実際にDBに接続することでSQLite以上の機能を使用できるようにしています。 PostgreSQLやMySQLの構文が使えるだけではなく、CSVファイルと実テーブルでJOINしたり、CSVファイルからテーブ
SELECT pgn.nspname, relname, pg_size_pretty(relpages::bigint * 8 * 1024) AS size, CASE WHEN relkind = 't' THEN (SELECT pgd.relname FROM pg_class pgd WHERE pgd.reltoastrelid = pg.oid) WHEN nspname = 'pg_toast' AND relkind = 'i' THEN (SELECT pgt.relname FROM pg_class pgt WHERE SUBSTRING(pgt.relname FROM 10) = REPLACE(SUBSTRING(pg.relname FROM 10), '_index', '')) ELSE (SELECT pgc.relname FROM pg_clas
PostgreSQL 編7 - 問い合わせ、レコード参照、クエリ、select、like、count ■データベース問い合わせ ・リレーショナルデータベース(RDB) では、select 文を用いて、実に様々な 問い合わせが可能である。 ・特定のデータを抜き出す指定は次のようにする。 この例では、key の先頭が「a」で始まるものだけが問い合わされる。 like は、部分一致を行う。 select key, data1, data2, data3 from testm where key like 'a%' order by key ; ・問い合わせ件数(照会件数)を引き取るには、次のようにする。 select count(*) from testm where key like 'a%'; ・次の構文はエラーとなる。 select key, data1, data2, data3, co
Let’s say that we have to import data from some social network. We will be provided with CSV file generated every 5 minutes containing list of posts that were added/liked/commented since the beginning of the day together with likes’ and comments’ counts for each post. As you can imagine the file will grow in size during the day; also we are looking at not only inserting new posts but also updating
こんにちは!SQL 大好き kano-e です。 「データ更新のたびに新規にテーブルを作って、そこにデータを投入したい」とか。 「お客様を DB に登録したら、合わせてそのお客様専用のテーブルを作っておきたい」とか。 「とにかくこの CSV の内容を DB に投入したい、10万件」とか。 こんな状況、意外と遭遇していませんか? この記事では、そんな時に多分役立つ「Rails で動的にテーブルを作成して、大きな CSV のデータを PostgreSQL にインポートする方法」について、思いつくままにまとめてみました。 合わせて読みたい「動的に作成したテーブルを db/schema.rb に含めない方法」のおまけ付きです。 はじめに この記事では、以下の内容についてまとめています。 Rails で動的にテーブルを CREATE/DROP する テーブルに対応するモデルを用意せずに SQL を組
Last updated: 2023-11-04 Items with (*) have a comment (or explanation) that is shown as a tooltip when hovering the mouse over them This comparison focuses on SQL features that can be used in SQL statements or self-contained SQL scripts that don't require additional software (e.g. a compiler) to be usable. Features for database administration or deployment are also not the focus of this compariso
SQL has gone out of fashion lately—partly due to the NoSQL movement, but mostly because SQL is often still used like 20 years ago. As a matter of fact, the SQL standard continued to evolve during the past decades resulting in the current release of 2016. In this session, we will go through the most important additions since the widely known SQL-92. We will cover common table expressions and window
This blog post simplifies certain concepts to be brief. If you're looking for examples on how to override the PostgreSQL planner and executor, please check out Citus on GitHub or download Citus here. By now, you've likely heard the line "SQL doesn't scale." If you take away all the marketing, what remains of this line is "SQL is hard to scale." At a high level, three reasons make scaling out SQL h
Polyhedral compilation uses the polyhedral model to represent programs as systems of affine inequalities over iteration variables. This allows loop transformations like fusion, distribution, skewing and reversal to be expressed as affine mappings on the iteration space. The key aspects are representing the iteration domain, scheduling functions that determine the execution order of statements, and
オープンソースデータベースを加速する「キムラデービー」のブログです。カレー日記を兼ねてます。なお著者は2010-06-01より日本オラクルに在籍していますが、本サイト(ブログ、またはウェブサイト)において示されている見解は、私自身の見解であって、オラクルの見解を必ずしも反映したものではありません。 結構人気(?) のこの記事、ざっとよもうと思ったら最初に誤植(?) があったので、通読してまとめておきます。。。。 [2014-10-09 12:00 追記] 現時点までに更新があり、下記指摘はほとんど修正・更新されているようですが、とりあえず記録のために本エントリは残しておきます。「誤植や誤記ねえじゃん」といわないでください。指摘の後更新されたので。。。。 SQLの観点から「Oracle Database」「PostgreSQL」 「MySQL」の特徴を整理しよう!(DBonline) なお、
今日から文体を常体にする。 データベースに最初からデータを入れておきたい場合、Railsではrake db:seedを使う。このタスクによりRailsアプリケーションがロードされた状態でdb/seeds.rbに書いたコードが実行される。 シード用データを作ること自体が重い場合(例えば外部のAPIを呼ばなければいけないとか、たくさんのjsonファイルを解析しなければいけないとか)、ローカルで流したスクリプトを再度プロダクション環境で流すのは馬鹿らしいので、ローカルのデータベースをダンプしたものを使うのが賢いのだと思う。 環境は次のものを想定する。 PostgreSQL Heroku PostgreSQLではpg_dump dbname > dump.sqlやpsql dbname < dump.sqlようなコマンドを使えるが、Herokuのような環境ではそれらのコマンドを直接叩けないことも多
PostgreSQL: The World's Most Advanced Open Source Relational Database PostgreSQL is a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance. There is a wealth of information to be found describing how to install and use PostgreSQL through the official documentation
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く