並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 40 件 / 68件

新着順 人気順

insert into select postgresql exampleの検索結果1 - 40 件 / 68件

  • 論理削除という技術的負債、それでも僕たちは使い続ける - じゃあ、おうちで学べる

    はじめに 「論理削除?deleted_atカラム追加すればいいでしょ」この一言から始まる地獄を、何度見てきただろうか。 最初は簡単に見える。カラムを1つ追加するだけ。しかし、その「簡単さ」こそが罠だ。 論理削除は技術的負債の温床だ。WHERE句への条件追加忘れ、認知コストの増大、テストの複雑化、パフォーマンス劣化。すべては「最初にドメインを考えなかった」ツケである。 しかし現実として、サービスを運用していくと論理削除が必要になる場面は確実に訪れる。 論理削除の本質は、「このレコードは存在するが、存在しないことにしてほしい」という矛盾だ。この矛盾を解消するか、受け入れて安全に管理するか。本記事ではその両方のアプローチを解説する。 なお、私はDBのスペシャリストではないので、ここで紹介する方法が唯一の正解というわけではない。あくまで一つのアプローチとして参考にしてほしい。データベース設計は文脈

      論理削除という技術的負債、それでも僕たちは使い続ける - じゃあ、おうちで学べる
    • 「Postgres で試した?」と聞き返せるようになるまでもしくはなぜ私は雰囲気で技術を語るのか? — Just use Postgres 読書感想文 - じゃあ、おうちで学べる

      はじめに 「Just use Postgres」という言葉を初めて聞いたのは、いつだったか覚えていません。Twitter か Hacker News か、あるいは社内の Slack か。どこで聞いたにせよ、私の反応は決まっていました。「また極端なことを言う人がいる」と。 「それ、〇〇でもできますよ」——この手のフレーズはもう100回は聞いてきました。そして大抵の場合、その〇〇は専用ツールに置き換えられていきます。技術が専門分化していくのは自然な流れです。 全文検索なら Elasticsearch。時系列データなら InfluxDB。メッセージキューなら RabbitMQ。それぞれの分野に専門家がいて、専用のソリューションがあって、ベストプラクティスがあります。「とりあえず Postgres で」なんて、それは思考停止ではないか、と。でも、心のどこかで気になっていたんです。 www.mann

        「Postgres で試した?」と聞き返せるようになるまでもしくはなぜ私は雰囲気で技術を語るのか? — Just use Postgres 読書感想文 - じゃあ、おうちで学べる
      • 【2020年】CTF Web問題の攻撃手法まとめ - こんとろーるしーこんとろーるぶい

        はじめに 対象イベント 読み方、使い方 Remote Code Execution(RCE) 親ディレクトリ指定によるopen_basedirのバイパス PHP-FPMのTCPソケット接続によるopen_basedirとdisable_functionsのバイパス JavaのRuntime.execでシェルを実行 Cross-Site Scripting(XSS) nginx環境でHTTPステータスコードが操作できる場合にCSPヘッダーを無効化 GoogleのClosureLibraryサニタイザーのXSS脆弱性 WebのProxy機能を介したService Workerの登録 括弧を使わないXSS /記号を使用せずに遷移先URLを指定 SOME(Same Origin Method Execution)を利用してdocument.writeを順次実行 SQL Injection MySQ

          【2020年】CTF Web問題の攻撃手法まとめ - こんとろーるしーこんとろーるぶい
        • Goで自作RDBMS - abekoh's tech note

          はじめに Goで自作RDBMSに挑戦してみたログです。自作、といっても大部分は参考にした書籍の移植です。 ここ1年くらいRDBに向き合う機会が多く、その内部実装を手を動かしながら身を持って理解してみたいというモチベーションから始めてみました。ちょうど会社の『内部構造から学ぶPostgreSQL』読書会に参加したこともモチベーション上げるきっかけとなりました。 (他の方の記事ですが、読書会の記録はこちら↓) 『内部構造から学ぶPostgreSQL』読書会を完走した感想 [改訂3版]内部構造から学ぶPostgreSQLの社内読書会振り返り データベースをデータの箱としか思っていなかった私の『内部構造から学ぶPostgreSQL』を読んだ感想 普段何気なく使ってるRDBMSですが、ACID特性を守るため・大量の読み書きを捌くため、非常に緻密に設計されております。 これを完全再現といかなくとも自分

            Goで自作RDBMS - abekoh's tech note
          • Goのsql.DBは、いつプールに戻しているのか

            はじめに 鍵を閉め忘れたような気がして心配になるように、リソースを後始末していたか心配になることはありませんか。 「習慣的にdeferでCloseしてるからリークしないはずたけど。あれ?トランザクションはしてなかったかも。ん?Closeないの!?」 Goの標準ライブラリの database/sql で中心となる sql.DB ではデフォルトでコネクションプールが使われるようになっていて明示的な操作は不要です。 ではいったい、どのタイミングでプールに返却されているのか、パターンを整理してみました。 準備 挙動の確認でINSERTやSELECTを実行するため、PostgreSQLに簡易なテーブルを作成しました。 CREATE TABLE shop ( id serial PRIMARY KEY, name text NOT NULL, created_at timestamp with tim

              Goのsql.DBは、いつプールに戻しているのか
            • Postgresqlのltreeを活用した階層構造の便利な利用法 - RAKUS Developers Blog | ラクス エンジニアブログ

              はじめに ltreeとは ltree型 ltreeの操作 活用法 1. 承認フローの構築 事前準備 テーブル作成 データ追加 2. テーブルに細かくアクセス制御をかける 事前準備 ltreeの有効化 テーブル作成 ポリシー作成 行セキュリティポリシーの有効化 ポリシーの設定 データを追加 ユーザー作成 試す まとめ はじめに こんにちは! エンジニア2年目のTKDSです! 今回はltreeについて調べ、その活用法を考えてみました。 ltreeについて、ltreeの活用法の2段構成です。 ltreeとは 階層ツリー構造を模した構造を格納する機能を提供する拡張機能です。 詳しくはドキュメントをみてください。 ltree型 階層ツリー構造を表す型です。 例)`Company.Department.Team1 ドット区切りで大文字小文字は区別しないようです。 各データはラベルと呼びます(上記でのC

                Postgresqlのltreeを活用した階層構造の便利な利用法 - RAKUS Developers Blog | ラクス エンジニアブログ
              • sqlc を TypeScript で利用する

                2024 年 12 月 25 日追記 sqlc と sqlc-gen-typescript は積極的なメンテナンスがされていないため、採用するときは注意してください。 まとめ sqlc-gen-typescript かなり良い 自分が TypeScript でウェブアプリを利用するなら間違いなく sqlc を選択する SQL は共通言語という点で本当に偉大 sqlc とは sqlc とは Go で書かれた SQL を元にコードを生成するツール。 なぜ sqlc ? 結局、それぞれの ORM 固有の技術を覚えるくらいなら SQL を覚えた方が早い 拡張に ORM が対応していようがいまいが関係ない SQL パーサーが libpg_query という実際の PostgreSQL サーバーソースを使用している wasilibs/go-pgquery を利用しているので信頼できる Wasm 化され

                  sqlc を TypeScript で利用する
                • PostgreSQL 18からNOT NULL制約をNOT VALIDで追加できるようになりました - エムスリーテックブログ

                  こんにちは! デジスマチームの山田です。これはデジスマチームのブログリレー3日目の投稿です。 本番稼動中のデータベースの運用において、NOT NULL制約を持たせたいカラムを既存のテーブルに追加する作業は頭を悩ませるものです。PostgreSQL 11(以下、PG11)以降、DEFAULTを固定の値で指定した場合のカラム追加は高速化されました。しかしDEFAULTとして固定値を用意するのではなく、各行ごとに異なる値の非NULLなカラムを追加したいというケースもあります。このような場合「一度NULLを許可してカラムを追加し、アプリケーションの改修やUPDATEによるバックフィルを完了させた後にNOT NULL制約を追加する」という手順を踏むことがあります。この際テーブルが長時間ロックされることを避けるためにCHECK制約を介した少し複雑な手順が必要でした。 そんな中PostgreSQL 18

                    PostgreSQL 18からNOT NULL制約をNOT VALIDで追加できるようになりました - エムスリーテックブログ
                  • Production query plans without production data

                    In the previous article we covered how the PostgreSQL planner reads pg_class and pg_statistic to estimate row counts, choose join strategies, and decide whether an index scan is worth it. The message was clear: when statistics are wrong, everything else goes with it. Streaming replication provides bit-to-bit replication, so all replicas share the same statistics with primary server. But there was

                      Production query plans without production data
                    • トリガーを用いたPostgreSQLのデータ変更検知方法 - RAKUS Developers Blog | ラクス エンジニアブログ

                      はじめに 事前準備 トリガーを使用する方法 補足:トリガーと関数のみ消す方法 まとめ はじめに こんにちは! エンジニア2年目のTKDSです! PostgreSQLでのテーブル変更検知方法について調べました。 今回はトリガーを使用する方法について説明します。 事前準備 DBの準備(compose.yaml) services: db: image: postgres:16.4-bullseye container_name: db environment: POSTGRES_USER: postgres POSTGRES_DB: postgres POSTGRES_PASSWORD: postgres ports: - "127.0.0.1:5432:5432" volumes: - db_data:/var/lib/postgresql/data - ./init.sql:/docker

                        トリガーを用いたPostgreSQLのデータ変更検知方法 - RAKUS Developers Blog | ラクス エンジニアブログ
                      • dbt (data build tool) を使ってデータをテストする - CUBE SUGAR CONTAINER

                        ソフトウェアエンジニアリングの世界では、自動化されたテストを使ってコードの振る舞いを検証するのが当たり前になっている。 同じように、データエンジニアリングの世界でも、自動化されたテストを使ってデータの振る舞いを検証するのが望ましい。 データをテストするのに使える OSS のフレームワークも、いくつか存在する。 今回は、その中でも dbt (data build tool) を使ってデータをテストする方法について見ていく。 dbt 自体はデータのテストを主目的としたツールではないものの、テストに関する機能も備えている。 また、dbt には WebUI を備えたマネージドサービスとしての dbt Cloud と、CLI で操作するスタンドアロン版の dbt Core がある。 今回扱うのは後者の dbt Core になる。 使った環境は次のとおり。 $ sw_vers ProductName:

                          dbt (data build tool) を使ってデータをテストする - CUBE SUGAR CONTAINER
                        • Welcome to Wildebeest: the Fediverse on Cloudflare

                          The Fediverse has been a hot topic of discussion lately, with thousands, if not millions, of new users creating accounts on platforms like Mastodon to either move entirely to "the other side" or experiment and learn about this new social network. Today we're introducing Wildebeest, an open-source, easy-to-deploy ActivityPub and Mastodon-compatible server built entirely on top of Cloudflare's Super

                            Welcome to Wildebeest: the Fediverse on Cloudflare
                          • Changing std::sort at Google’s Scale and Beyond

                            TL;DR; We are changing std::sort in LLVM’s libcxx. That’s a long story of what it took us to get there and all possible consequences, bugs you might encounter with examples from open source. We provide some benchmarks, perspective, why we did this in the first place and what it cost us with exciting ideas from Hyrum’s Law to reinforcement learning. All changes went into open source and thus I can

                              Changing std::sort at Google’s Scale and Beyond
                            • 【PGlite】WebAssemblyでPostgreSQLを軽量に - RAKUS Developers Blog | ラクス エンジニアブログ

                              はじめに PGliteの概要 PGliteの特徴 PGliteを試す ブラウザで使う PGliteの速度計測 まとめ はじめに こんにちは!エンジニア2年目のTKDSです! 今回はPGliteについて調べてみました! 概要・使い方・速度実験・まとめの内容で記事は構成されています。 使ってみた結果として、軽量高速であり色々使いみちがありそうなツールだと感じました。 ぜひ最後まで読んでいただけると幸いです。 PGliteの概要 PGliteは、PostgreSQLをWebAssembly(WASM)にコンパイルした軽量なデータベースエンジンです。 これにより、ブラウザ、Node.js、Bun、DenoなどでPostgreSQLの機能を利用でき、開発者はローカルやサーバーレス環境でデータベース操作を行うことが可能です。 PGliteは、インメモリデータベースやファイルシステム(Node.jsやB

                                【PGlite】WebAssemblyでPostgreSQLを軽量に - RAKUS Developers Blog | ラクス エンジニアブログ
                              • GitHub - tkuchiki/slp: SlowLog Profiler for MySQL and PostgreSQL

                                $ slp --help slp is a MySQL/PostgreSQL SlowLog Profiler Usage: slp [flags] slp [command] Available Commands: completion Generate the autocompletion script for the specified shell diff Show the difference between the two profile results help Help about any command my Profile the slowlogs for MySQL pg Profile the slowlogs for PostgreSQL Flags: --config string The configuration file -h, --help help f

                                  GitHub - tkuchiki/slp: SlowLog Profiler for MySQL and PostgreSQL
                                • Introduction to Postgres Indexes – Frontend Masters Blog

                                  This Part 1 (of a 2-part series) is a practical, hands-on, applicable approach to database indexes. We’ll cover what B Trees are with a focus on deeply understanding, and internalizing how they store data on disk, and how your database uses them to speed up queries. This will set us up nicely for part 2, where we’ll explore some interesting, counterintuitive ways to press indexes into service to a

                                    Introduction to Postgres Indexes – Frontend Masters Blog
                                  • Parsing SQL - Strumenta

                                    The code for this tutorial is on GitHub: parsing-sql SQL is a language to handle data in a relational database. If you worked with data you have probably worked with SQL. In this article we will talk about parsing SQL. It is in the same league of HTML: maybe you never learned it formally but you kind of know how to use it. That is great because if you know SQL, you know how to handle data. However

                                      Parsing SQL - Strumenta
                                    • The Part of PostgreSQL We Hate the Most

                                      This article was written in collaboration with Bohan Zhang and originally appeared on the OtterTune website. There are a lot of choices in databases (897 as of April 2023). With so many systems, it’s hard to know what to pick! But there is an interesting phenomenon where the Internet collectively decides on the default choice for new applications. In the 2000s, the conventional wisdom selected MyS

                                        The Part of PostgreSQL We Hate the Most
                                      • Introducing pg_karnak: Transactional schema migration across tenant databases

                                        Introducing pg_karnak: Transactional schema migration across tenant databases When we need to describe Nile in a single sentence, we say "PostgreSQL re-engineered for multi-tenant apps". By multi-tenant apps, we mean applications like Stripe, Figma, Twilio, Notion, Workday, and Gusto - here a large number of customers is served from a shared application stack. In these types of applications, a key

                                          Introducing pg_karnak: Transactional schema migration across tenant databases
                                        • Building a recommendation engine inside Postgres with Python and Pandas | Crunchy Data Blog

                                          Building a recommendation engine inside Postgres with Python and Pandas I'm a big fan of data in general. Data can tell you a lot about what users are doing and can help you gain all sorts of insights. One such aspect is in making recommendations based on past history or others that have made similar choices. In fact, years ago I wrote a small app to see if I could recommend wines based on how oth

                                            Building a recommendation engine inside Postgres with Python and Pandas | Crunchy Data Blog
                                          • Techouse社内勉強会の内容を紹介します(1) データベース<ACID編> - Techouse Developers Blog

                                            Techouseの「エンジニア基礎勉強会」とは Techouse では「基礎勉強会」と称して2週間に1回、わたしが OS・ネットワーク・データベース・ハードウェア・セキュリティ・システムアーキテクチャなどをお話する勉強会を開催しています。 講師は私ひとり、資料を準備するのも私ひとり、動画を収録して YouTube Live で社内向けに配信する作業も私ひとりでやってます。 参加は任意ですが、社内のメンバー (社員・インターン生・業務委託でご参画いただいている方) の多くの方が参加してくれています。先日の RubyKaigi 2024 に参加してくれたメンバーもほとんどがこの勉強会に参加し、基礎的な知識をもった上でセッションへ臨んでくれました。 開催履歴 これまでの開催履歴はこんな具合です。 見ていただくとわかる通り、ほんとうに基礎的な内容を1個ずつやっているということがわかるかと思います。

                                              Techouse社内勉強会の内容を紹介します(1) データベース<ACID編> - Techouse Developers Blog
                                            • What’s new in the Postgres 16 query planner / optimizer

                                              What’s new in the Postgres 16 query planner / optimizer Written by David Rowley February 8, 2024 PostgreSQL 16 introduces quite a few improvements to the query planner and makes many SQL queries run faster than they did on previous versions of PostgreSQL. If you look at the PG16 release notes, you’ll see some of these planner improvements. But with the volume of changes made in each PostgreSQL rel

                                                What’s new in the Postgres 16 query planner / optimizer
                                              • Row Level Security で事故らないアプリケーションを構築する - FLINTERS Engineer's Blog

                                                こんにちは、清水(@_smzst)です。直近の業務でマルチテナントな DB でアプリケーションでのスイッチロール機能を実現するために Amazon Cognito や表題にある Row Level Security について技術検証や設計検討を行っていました。 今回はこの Row Level Security について PostgreSQL での例を挙げて挙動を確認しながら、実際に導入するにあたって必要な知識や注意点までを網羅します。本記事が安全で堅牢なアプリケーション構築の一助となれば幸いです。 1. マルチテナントとは 2. Row Level Security とは 3. 実際に試してみる 3-1. 実現するための SQL 3-2. RLS 有効化前 3-3. RLS 有効化後 4. 補足 4-1. クエリのパフォーマンスについて 4-2. ユーザーとロールの管理について 4-3.

                                                  Row Level Security で事故らないアプリケーションを構築する - FLINTERS Engineer's Blog
                                                • Fluentd向けApache Arrowプラグインについて - KaiGaiの俺メモ

                                                  構想は半年ほど前?ここ一ヶ月ほど集中して開発に取り組んでいた、Fluentd向けApache Arrowプラグインがようやく動くようになったので、今回はこちらのモジュールについてご紹介します。 そもそもPG-Stromは、IoT/M2M領域で大量に発生するデータを高速に処理できますというのがセールスポイントで、GPU-Direct SQLはじめ、各種の機能によってそれを実現しているワケですが、実際に運用する際には、発生したデータを『どうやってSQLで処理できるようDBにインポートするか?』という問題があります。 例えば、PostgreSQLに一行ずつINSERTするというのも一つの解です。ただし、単純なI/Oに比べると、DBへの書き込みはどうしても処理ボトルネックになりがちです。 そこで、大量に収集するログデータを、少ない時間ロスで(つまり一時ファイルに保存したデータを再度DBにインポート

                                                    Fluentd向けApache Arrowプラグインについて - KaiGaiの俺メモ
                                                  • Python: Just write SQL

                                                    I have been writing a lot more Go this past year. For those not familiar, Go favours a non-ORM, non-query-builder approach to interacting with databases. This comes naturally due to the sql package: A common interface to be used alongside database drivers. It’s very common to see actual SQL in Go, even in large projects. On the other hand, Python does not have anything in the standard library that

                                                    • goでValueObject(値オブジェクト) を実装する - 電通総研 テックブログ

                                                      これは電通国際情報サービス アドベントカレンダーの17日目の記事です。 はじめに 開発環境 ValueObject(値オブジェクト)とは? 実装方針のアプローチ 構造体として実装し、フィールドに値を保持し、必要な機能をメソッドで外部公開する defined typeとして実装し、必要な機能をメソッドで外部公開する 両アプローチの考察 データベースへの永続化 Value関数 Scan関数 実際にRDBに永続化してみる 値オブジェクトの実装 DB永続化処理 終わりに はじめに みなさんこんにちは。電通国際情報サービス(ISID) 金融ソリューション事業部の水野です。 今回は、値オブジェクトをgo言語でどのように実装したかをご紹介します。 値の生成から振る舞いの実装、データベースへの永続化の際に如何に透過的に扱うかまでを見ていきます。 開発環境 Visual Studio Code 1.62.2

                                                        goでValueObject(値オブジェクト) を実装する - 電通総研 テックブログ
                                                      • Making state easy with D1 GA, Hyperdrive, Queues and Workers Analytics Engine updates

                                                        For those who’ve been following D1 since the start: this is the same pricing we announced at open beta But things don’t just stop at GA: we have some major new features lined up for D1, including global read replication, even larger databases, more Time Travel capabilities that will allow you to branch your database, and new APIs for dynamically querying and/or creating new databases-on-the-fly fr

                                                          Making state easy with D1 GA, Hyperdrive, Queues and Workers Analytics Engine updates
                                                        • Parquet and Postgres in the Data Lake | Crunchy Data Blog

                                                          Interested in Spatial analytics? You can now connect Postgres and PostGIS to CSV, JSON, Parquet / GeoParquet, Iceberg, and more with Crunchy Data Warehouse. Static Data is DifferentA couple weeks ago, I came across a blog from Retool on their experience migrating a 4TB database. They put in place some good procedures and managed a successful migration, but the whole experience was complicated by t

                                                            Parquet and Postgres in the Data Lake | Crunchy Data Blog
                                                          • Lesser Known PostgreSQL Features

                                                            In 2006 Microsoft conducted a customer survey to find what new features users want in new versions of Microsoft Office. To their surprise, more than 90% of what users asked for already existed, they just didn't know about it. To address the "discoverability" issue, they came up with the "Ribbon UI" that we know from Microsoft Office products today. Office is not unique in this sense. Most of us ar

                                                              Lesser Known PostgreSQL Features
                                                            • DSQL Vignette: Aurora DSQL, and A Personal Story - Marc's Blog

                                                              About Me My name is Marc Brooker. I've been writing code, reading code, and living vicariously through computers for as long as I can remember. I like to build things that work. I also dabble in machining, welding, cooking and skiing. I'm currently an engineer at Amazon Web Services (AWS) in Seattle, where I work on databases, serverless, and serverless databases. Before that, I worked on EC2 and

                                                              • Go開発者によるDDDの実践:概念理解から具体的な応用まで - DMM Developers Blog

                                                                1. はじめに 2. 既存管理画面のリプレース背景 2.1 技術選定の理由 2.1.1 フロントエンド: React 2.1.2 バックエンド: Go 2.1.3 設計: ドメイン駆動設計(DDD) 2.2 再構築による期待効果 3. DDD導入における課題 3.1 DDDの概念理解と実践のギャップ 3.2 Go言語におけるDDD実装のノウハウ不足 3.3 ビジネスロジックの適切な配置 4. 課題解決に向けた対策 5. Go言語を用いたDDDの実践 5.1 DDDの基本概念 5.1.1 ドメイン (Domain) 5.1.2 エンティティ (Entity) 5.1.3 バリューオブジェクト (Value Object) 5.1.4 アグリゲート (Aggregate) 5.1.5 リポジトリ (Repository) 5.1.6 サービス (Service) 5.2 DDDにおけるDI/D

                                                                  Go開発者によるDDDの実践:概念理解から具体的な応用まで - DMM Developers Blog
                                                                • Build an API in Rust with JWT Authentication using actix-web

                                                                  Rust has picked up a lot of momentum since we last looked at it in 2015. Companies like Amazon and Microsoft have adopted it for a growing number of use cases. Microsoft, for example, sponsors the Actix project on GitHub, which is a general purpose open source actor framework based on Rust. The Actix project also maintains a RESTful API development framework, which is widely regarded as a fast and

                                                                    Build an API in Rust with JWT Authentication using actix-web
                                                                  • 週刊Railsウォッチ: Evil MartiansのDocker+Rails記事が大幅更新、Railsガイドが電子書籍でほか(20220328前編)|TechRacho by BPS株式会社

                                                                    週刊Railsウォッチについて 各記事冒頭には🔗でパーマリンクを置いてあります: 社内やTwitterでの議論などにどうぞ 「つっつきボイス」はRailsウォッチ公開前ドラフトを(鍋のように)社内有志でつっついたときの会話の再構成です👄 お気づきの点がありましたら@hachi8833までメンションをいただければ確認・対応いたします🙏 TechRachoではRubyやRailsなどの最新情報記事を平日に公開しています。TechRacho記事をいち早くお読みになりたい方はTwitterにて@techrachoのフォローをお願いします。また、タグやカテゴリごとにRSSフィードを購読することもできます(例:週刊Railsウォッチタグ) 🔗Rails: 先週の改修(Rails公式ニュースより) 今回は以下のChangelogから見繕いました 更新差分: Comparing @{2022-03

                                                                      週刊Railsウォッチ: Evil MartiansのDocker+Rails記事が大幅更新、Railsガイドが電子書籍でほか(20220328前編)|TechRacho by BPS株式会社
                                                                    • GoのFacebook製ORM"ent"を使ってみた - SMARTCAMP Engineer Blog

                                                                      こんにちは。スマートキャンプ エンジニアの中田です。 皆さんはGoのORMには何を使われていますか? 有名どころだと機能の豊富なGORMや取得データのマッピング部分だけを担うシンプルなsqlx、 最近だとテーブル定義からモデルコードの自動生成してくれるSQLBoilerなど、Goには多くのORMがあります。 筆者のORM遍歴は以下のようになってます。 Active Record(Ruby on Rails): 2年ほど GORM(Go): 半年ほど 弊社のプロダクトのバックエンドはRuby on Railsで作られているものがほとんどです。 Ruby on Railsを利用しての開発経験が私のキャリアの大半を占めていることもあり、個人的にActiveRecordのような機能の網羅率の高いORMには安心感を覚えます。 半年前から新規で開発を始めたプロダクトにて、新たにGoを利用し始めました。

                                                                        GoのFacebook製ORM"ent"を使ってみた - SMARTCAMP Engineer Blog
                                                                      • PostgreSQL 18の新機能、仮想生成列の使い方や制約、格納生成列との使い分けについて | フューチャー技術ブログ

                                                                        PostgreSQL 18連載の3本目です。 PostgreSQL 18がリリースされ、仮想生成列についてまとめます。PostgreSQLで従来から利用できた格納生成列や、生成列自体と合わせて紹介します。 生成列生成列は他の列から計算される列のことで、テーブルに対するビューをつくるように、ある列に対してビューのような列を作ることができます。ビューにも、MViewと通常のViewがあるように、生成列も「格納生成列」と「仮想生成列」の2種類があります。格納生成列は、登録/更新時に計算されて物理的にストレージが割り当てられます(MVIEWに似ています)。仮想列は列が読み取られる時に動的に計算されます(Viewに似ています)。 PostgreSQL 12で「格納」生成列が利用可能となり、今回18から「仮想」生成列が利用可能となりました。ここまで説明した内容をざっと、表でまとめました。 特徴格納生成

                                                                          PostgreSQL 18の新機能、仮想生成列の使い方や制約、格納生成列との使い分けについて | フューチャー技術ブログ
                                                                        • Database Fundamentals

                                                                          About a year ago, I tried thinking which database I should choose for my next project, and came to the realization that I don't really know the differences of databases enough. I went to different database websites and saw mostly marketing and words I don't understand. This is when I decided to read the excellent books Database Internals by Alex Petrov and Designing Data-Intensive Applications by

                                                                            Database Fundamentals
                                                                          • Aurora PostgreSQLでテーブルパーティショニングを導入した話 【実践編】 - GO Tech Blog

                                                                            技術戦略部 SREグループの古越です。 前回の記事でパーティショニングを導入する段階で注意するポイントについて主に触れてきました。今回は導入するために具体的に行った事や追加で導入する拡張機能の解説などを踏まえて紹介していきます。 前提知識と導入するまでの背景については前回の検討編を見て頂ければと思います。 Aurora PostgreSQLでテーブルパーティショニングを導入した話 【検討編】 実践したこと 前回のブログでも軽く触れましたが、導入する前には以下を重点的に検証し、実践しました。 パーティション管理の自動化のため pg_partmanを導入する local開発環境でpg_partmanを利用可能にする Aurora PostgreSQLパラメーターのチューニング パーティションの一部をS3にエクスポートする このあたりを具体的に解説していければと思います。 1. pg_partm

                                                                              Aurora PostgreSQLでテーブルパーティショニングを導入した話 【実践編】 - GO Tech Blog
                                                                            • I Migrated from a Postgres Cluster to Distributed SQLite with LiteFS

                                                                              I Migrated from a Postgres Cluster to Distributed SQLite with LiteFSNovember 21st, 2022 — 22 min read Over the last few months, I've been heads-down on building the content for EpicWeb.dev. And I've been building it all in the open on my YouTube channel. If you've been watching my EpicWeb.dev live streams, you'll know that I've been building the app we'll use to learn web dev: Rocket Rental 🚀. Wi

                                                                                I Migrated from a Postgres Cluster to Distributed SQLite with LiteFS
                                                                              • SQLite Features You Didn’t Know It Had: JSON, text search, CTE, STRICT, generated columns, WAL

                                                                                Working with JSON data SQLite ships with a JSON extension that lets you store and query JSON documents directly in tables. You can keep your schema flexible while still using SQL to slice and dice structured data. Example: extracting fields from a JSON column: CREATE TABLE events ( id INTEGER PRIMARY KEY, payload TEXT NOT NULL -- JSON ); SELECT json_extract(payload, '$.user.id') AS user_id, json_e

                                                                                  SQLite Features You Didn’t Know It Had: JSON, text search, CTE, STRICT, generated columns, WAL
                                                                                • Node.js(Express.js)環境でPrisma ORMを使いこなすための基礎 | アールエフェクト

                                                                                  アプリケーションを構築する場合にはデータを保存するため必ずデータベースが必要となります。データベースを効率的に管理し、簡単に操作を行うためのツールがPrismaです。本文書はこれまでPrismaを利用したことがない人を対象にPrismaを利用する上での基本的な操作と設定方法について説明を行なっています。 Prismaはサーバからデータベースを操作する際にサーバとデータベースの間を仲介する役目を持っておりデータベースを操作する際はどのデータベースを利用しているか意識することなく共通のオブジェクトメソッドを利用することができます。本文書ではサーバにExpress.jsを利用して最初はデータベースのSQLiteを利用します。SQLiteで一通り動作を確認した後にクラウドサービスのSupabase(PostgreSQL)に変更します。データベースの変更を行なってもSQLiteで行なった処理と同じ操

                                                                                    Node.js(Express.js)環境でPrisma ORMを使いこなすための基礎 | アールエフェクト