LoginSignup
0
0

More than 3 years have passed since last update.

PostgreSQLでbytea型のバイト数をカウントする

Posted at

この記事は

タイトル通りです。

自己紹介

Java(Spring Boot)のWebアプリ開発を主にやってます。

書き方

  • octet_length関数をつかいます。
  • テーブルhoge_tblのカラムdata(bytea型)のサイズを知りたいときは以下のようにします。
select octet_length(data) from hoge_tbl;
  • カラムdataの全レコードのサイズ合計はsumでくるめばよいです。
select sum(octet_length(data)) from hoge_tbl;

さいごに

以上です!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0