offline15
offline15

Reputation: 357

How can i check in Postgresql if specific index is loaded to memory?

Is there any way to check if index is loaded to memory?

Upvotes: 5

Views: 5639

Answers (3)

Greg Smith
Greg Smith

Reputation: 18136

Note that PostgreSQL can't execute queries just based on the index data. It has to visit the data in order to determine what information is visible from the perspective of the query; that information is only in the rows themselves, not in the index. It's quite possible the index is all in RAM, but you're still seeing heavy I/O because the table doesn't fit there.

Upvotes: 2

Peter Eisentraut
Peter Eisentraut

Reputation: 36729

Use PgFincore for that.

Note that this question really has a two step solution because PostgreSQL has a two-level caching mechanism. pg_buffercache is the right tool for examining the PostgreSQL shared buffer cache. pgfincore is the right tool for examining the operating system's cache.

Upvotes: 1

Frank Heikens
Frank Heikens

Reputation: 127056

Check the contrib module pg_buffercache

After installation you can use this query to see if the table and index are in the buffercache:

SELECT
    DISTINCT
    relname
FROM
    pg_buffercache
        JOIN pg_class USING (relfilenode)
WHERE
    relname IN('your_tablename','your_index_name'); 

Upvotes: 5

Related Questions