Search Postgresql Archives

Re: intarray internals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 06, 2006 at 12:46:01AM +0300, Volkan YAZICI wrote:
> [1]
> What's the function of execute() in _int_bool.c? As far as I can
> understand, some other functions (eg. execconsistent()) calling
> execute() with specific check methods (like checkcondition_bit()) but
> I still couldn't figure out which functionality execute() stands for.

It's a boolean expression evaluator. The query given is some kind of
boolean expression. That function is a recusive function that evaluates
the expression given certain information.

> [2]
> In g_int_decompress(), shouldn't
> 
> if (ARRISVOID(in))
>     PG_RETURN_POINTER(entry);
> 
> part be replaced with
> 
> if (ARRISVOID(in))
> {
>     if (in != (ArrayType *) DatumGetPointer(entry->key))
>         pfree(in);
>     PG_RETURN_POINTER(entry)
> }

You very rarely need to pfree() anything explicitly. However, the code
has just tested if in is VOID. If it is, you obviously don't need to
free it. Or it may not be big enough to bother explicitly freeing.

> 
> [3]
> Again, in g_int_decompress(), I couldn't figure out the functionality of
> below lines:
> 
> din = ARRPTR(in);
> lenr = internal_size(din, lenin);
> 
> for (i = 0; i < lenin; i += 2)
>     for (j = din[i]; j <= din[i + 1]; j++)
>         if ((!i) || *(dr - 1) != j)
>             *dr++ = j;
> 
> If I understand right, above loop, tries to reconstruct array with more
> smaller intervals - to be able to make more accurate predicates while
> digging into nodes. If so, AFAICS, g_int_compress() and
> g_int_decompress() methods can be (quite?) improved.

Well, it's probably trying to undo whatever g_int_compress. If you can
explain the algorithm used it will probably be clearer.

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog@xxxxxxxxx>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux