Re: Strangely Variable Query Performance
| От | Tom Lane |
|---|---|
| Тема | Re: Strangely Variable Query Performance |
| Дата | |
| Msg-id | 9457.1176416569@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Strangely Variable Query Performance (Steve <cheetah@tanabi.org>) |
| Ответы |
Re: Strangely Variable Query Performance
|
| Список | pgsql-performance |
Steve <cheetah@tanabi.org> writes:
> Datum ddd_text_revcmp(PG_FUNCTION_ARGS){
> char* arg1=(char*)VARDATA(PG_GETARG_TEXT_P(0));
> char* arg2=(char*)VARDATA(PG_GETARG_TEXT_P(1));
> if((*arg1) != (*arg2)){
> PG_RETURN_INT32(*arg2 - *arg1);
> }else{
> PG_RETURN_INT32(strcmp(arg2,arg1));
> }
> }
[ itch... ] That code is just completely wrong, because the contents
of a TEXT datum aren't guaranteed null-terminated. It'd be better to
invoke bttextcmp and negate its result.
That's not relevant to your immediate problem, but if you've noticed
any strange behavior with your text_revop indexes, that's the reason...
regards, tom lane
В списке pgsql-performance по дате отправления: