Re: invalid memory alloc request size 576460752438159360

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Ibrahim Edib Kokdemir <kokdemir(at)gmail(dot)com>
Cc: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: invalid memory alloc request size 576460752438159360
Date: 2017-12-31 21:39:06
Message-ID: CAH2-Wzk8aNHKO8AVOMJy8yToeBv8vpf73bBC9KrTJDgNsexbMg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Dec 31, 2017 at 1:10 PM, Ibrahim Edib Kokdemir
<kokdemir(at)gmail(dot)com> wrote:
> I just installed and used amcheck_next, I have used your sample query on the
> git page (changed the schema name) and that listed all indexes different
> schemes and produced same outputs like yours with bt_index_check field as
> empty, that means no error.
> Am I doing right?

You should give the argument of heapallindexed as 'true'. So:

SELECT bt_index_check(index => c.oid, heapallindexed => true),
c.relname,
c.relpages
FROM pg_index i
JOIN pg_opclass op ON i.indclass[0] = op.oid
JOIN pg_am am ON op.opcmethod = am.oid
JOIN pg_class c ON i.indexrelid = c.oid
JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE am.amname = 'btree' AND n.nspname = 'pg_catalog'
-- Don't check temp tables, which may be from another session:
AND c.relpersistence != 't'
-- Function may throw an error when this is omitted:
AND i.indisready AND i.indisvalid
ORDER BY c.relpages DESC LIMIT 10;

As I mentioned earlier, if this takes too long, you could only do
heapallindexed checking once per table (not once per index) by giving
"indisprimary" as the heapallindexed argument. That way, only primary
keys would be verified against the heap, which is potentially a lot
faster.

--
Peter Geoghegan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Geoghegan 2017-12-31 21:53:49 Re: invalid memory alloc request size 576460752438159360
Previous Message Ibrahim Edib Kokdemir 2017-12-31 21:10:45 Re: invalid memory alloc request size 576460752438159360