X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 0A7229FA38E for ; Sat, 6 May 2006 07:13:17 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 23695-07 for ; Sat, 6 May 2006 07:13:06 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svana.org (svana.org [125.62.94.225]) by postgresql.org (Postfix) with ESMTP id 8C02C9F9431 for ; Sat, 6 May 2006 07:13:06 -0300 (ADT) Received: from kleptog by svana.org with local (Exim 4.50) id 1FcJmZ-0001KF-Ow; Sat, 06 May 2006 20:13:03 +1000 Date: Sat, 6 May 2006 12:13:03 +0200 From: Martijn van Oosterhout To: Volkan YAZICI Cc: pgsql-general@postgresql.org Subject: Re: intarray internals Message-ID: <20060506101303.GB4413@svana.org> Reply-To: Martijn van Oosterhout Mail-Followup-To: Volkan YAZICI , pgsql-general@postgresql.org References: <20060505214601.GA208@alamut> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IrhDeMKUP4DT/M7F" Content-Disposition: inline In-Reply-To: <20060505214601.GA208@alamut> X-PGP-Key-ID: Length=1024; ID=0x0DC67BE6 X-PGP-Key-Fingerprint: 295F A899 A81A 156D B522 48A7 6394 F08A 0DC6 7BE6 X-PGP-Key-URL: User-Agent: Mutt/1.5.9i X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kleptog@svana.org X-SA-Exim-Scanned: No (on svana.org); SAEximRunCond expanded to false X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/250 X-Sequence-Number: 95042 --IrhDeMKUP4DT/M7F Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 >=20 > if (ARRISVOID(in)) > PG_RETURN_POINTER(entry); >=20 > part be replaced with >=20 > if (ARRISVOID(in)) > { > if (in !=3D (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. >=20 > [3] > Again, in g_int_decompress(), I couldn't figure out the functionality of > below lines: >=20 > din =3D ARRPTR(in); > lenr =3D internal_size(din, lenin); >=20 > for (i =3D 0; i < lenin; i +=3D 2) > for (j =3D din[i]; j <=3D din[i + 1]; j++) > if ((!i) || *(dr - 1) !=3D j) > *dr++ =3D j; >=20 > 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, --=20 Martijn van Oosterhout http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to l= itigate. --IrhDeMKUP4DT/M7F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFEXHavIB7bNG8LQkwRAsV7AJ9UekcgNTUhfGJZL2UVyV/jwE/a8wCggxyO nFm5OlOXlup1Z796E9dhGn4= =Cnbt -----END PGP SIGNATURE----- --IrhDeMKUP4DT/M7F--