GithubHelp home page GithubHelp logo

Comments (4)

ryusei145 avatar ryusei145 commented on September 27, 2024 2

I think when you make PGroonga index, system creates some Postgres objects and Groonga objects. pg_relation_size function returns Postgres objects size as 0 but you can get Groonga objects size as shown below.

  1. Retrieve relindex id for PGroonga index.
  2. Retrieve Grronga object names using object_list command
    (I can get Groonga table object name and column object name by pgroonga_table_name()/pgroonga_index_column_name() function but I could not get any other object names.)
  3. Retrieve Groonga object disk usage using object_inspect command (Groonga) and pgroonga_command() function (PGroonga ) for each objects you get at 2.
postgres=# \d test;
                       Table "public.test"
 Column |         Type          | Collation | Nullable | Default
--------+-----------------------+-----------+----------+---------
 col1   | character varying(20) |           |          |
 col2   | character varying(20) |           |          |
 col3   | character varying(30) |           |          |
Indexes:
    "test_idx" pgroonga (col1, col2)

postgres=# select i.relname, ix.indexrelid from pg_index ix inner join pg_class as i on i.oid = ix.indexrelid where i.relname = 'test_idx';
 relname  | indexrelid
----------+------------
 test_idx |      17190
(1 row)

postgres=# select key, value->'path' from json_each(pgroonga_command('object_list')::json->1) where key like '%17190%';
         key          |       ?column?
----------------------+-----------------------
 Sources17190         | "base/5/pgrn.0000149"
 Lexicon17190_0       | "base/5/pgrn.000014A"
 Sources17190.col1    | "base/5/pgrn.000014B"
 Lexicon17190_0.index | "base/5/pgrn.000014C"
 Lexicon17190_1       | "base/5/pgrn.000014D"
 Sources17190.col2    | "base/5/pgrn.000014E"
 Lexicon17190_1.index | "base/5/pgrn.000014F"
(7 rows)

postgres=# select pgroonga_command('object_inspect Sources17190')::json->1->'disk_usage';
 ?column?
----------
 12648448
(1 row)

from pgroonga.

hiroyuki-sato avatar hiroyuki-sato commented on September 27, 2024

@rodo

A few month ago, I asked same question.

There are no index size command for pgroonga yet.
Alternatively, you can calculate index size with du command.

du -sk ${PGDATA}/base/${DB_ID}/pgrn*

Maybe that command will be introduce.
ie. pgroonga.disk_usage(index_name)

from pgroonga.

rodo avatar rodo commented on September 27, 2024

@hiroyuki-sato thanks a lot for you answer, I'll do calculate this way.

from pgroonga.

warflash avatar warflash commented on September 27, 2024

Hey ๐Ÿ‘‹
Is there any update on this? I feel like getting easy and accurate index sizes would be a very nice addition. Especially since (atleast in my experience) fulltext indices tend to harder to predict when it comes to their size

from pgroonga.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.