compute_index_stats is missing a CHECK_FOR_INTERRUPTS

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема compute_index_stats is missing a CHECK_FOR_INTERRUPTS
Дата
Msg-id CAMkU=1zQNPzOXLs4QuMPwkw3=5BT8iyKHJcvBKtq2JazZ=dfZQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: compute_index_stats is missing a CHECK_FOR_INTERRUPTS  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Analyze on functional indexes cannot be interrupted very easily.

Example:

create language plperl;
create table foo1 as select x::text from generate_series(1,1000) foo (x);
create table foo2 as select reverse(x) from foo1;
--use a fast version to set up the demo, as we are impatient
CREATE or replace FUNCTION slow_reverse(text) RETURNS text
    LANGUAGE plperl IMMUTABLE STRICT COST 1000000
    AS $_X$
  return reverse($_[0]);
$_X$;
create index on foo2 (slow_reverse(reverse));
analyze foo2;
--put the slow version in place.
CREATE or replace FUNCTION slow_reverse(text) RETURNS text
    LANGUAGE plperl IMMUTABLE STRICT COST 1000000
    AS $_X$
  my $foo; foreach (1..1e6) {$foo+=sqrt($_)};
  return reverse($_[0]);
$_X$;

-- now spring the trap
analyze foo2;

Ctrl-C (or pg_ctl stop -mf) hangs for a long time.

The attached patch fixes it, but don't vouch for its safety.

I believe I've seen a real-world example of this causing refusal of a fast shutdown to shutdown fast.

Cheers,

Jeff
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andreas Karlsson
Дата:
Сообщение: Re: Index-only scans with btree_gist
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Manipulating complex types as non-contiguous structures in-memory