Re: tsearch refactorings

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: tsearch refactorings
Дата
Msg-id 46DEDF68.8040802@enterprisedb.com
обсуждение исходный текст
Ответ на Re: tsearch refactorings  (Teodor Sigaev <teodor@sigaev.ru>)
Ответы Re: tsearch refactorings  (Teodor Sigaev <teodor@sigaev.ru>)
Список pgsql-patches
Teodor Sigaev wrote:
>> Ok. Probably easiest to do that by changing the palloc to palloc0 in
>> parse_tsquery.
>
> and change sizeof to sizeof(QueryItem)

Do you mean the sizeofs in the memcpys in parse_tsquery? You can't
change them. The source structs are allocated in
pushOperand/pushOperator, using sizeof(QueryOperand/QueryOperator), so
if you copy sizeof(QueryItem) bytes from them, you'll copy some random
piece of memory. If you just allocate the TSQuery with palloc0, that'll
make sure that any memory area not copied into in the loop will be zero.

BTW, can you explain what the CRC-32 of a value is used for? It looks
like it's used to speed up some operations, by comparing the CRCs before
comparing the values, but I didn't quite figure out how it works. How
much of a performance difference does it make? Would hash_any do a
better/cheaper job?

In any case, I think we need to calculate the CRC/hash in tsqueryrecv,
instead of trusting the client.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

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

Предыдущее
От: Teodor Sigaev
Дата:
Сообщение: Re: tsearch refactorings
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Lazy xid assignment V4