Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Strangely Variable Query Performance



Steve <cheetah(at)tanabi(dot)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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group