Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id CB7A563252F for ; Wed, 7 Apr 2010 03:18:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 76084-04 for ; Wed, 7 Apr 2010 06:17:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-yx0-f195.google.com (mail-yx0-f195.google.com [209.85.210.195]) by mail.postgresql.org (Postfix) with ESMTP id 129866324A3 for ; Wed, 7 Apr 2010 03:17:55 -0300 (ADT) Received: by yxe33 with SMTP id 33so431646yxe.15 for ; Tue, 06 Apr 2010 23:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type; bh=WLoclqnxZqcxFeslYWJktHNGfvyN7bSyBborbq31tFU=; b=fvv0nVRvTFrrpPP8Qwy3kSWhqpldrWRaLcOElyDLvLQH+YY6Gju82Aa0uG45rVcYyK PdUjnFZkxN0mxAawkWjgWASZvl5NL6hb5tRahgpDx9s9GAe2hjXQjC/OrvTEz6vdYY12 4BfMr9xkjmfY+bcu0M8Sn5pBtBdtW0ZxhgW1U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=IQb6DhBop7QlQrLtFXfeIOgx82IhkfWNFkdNmzZWfx64mmlkB/H2NVYlhzSaKhhBMN 0v2YCc73Z9lwxmQbfS5+i5fSjrQWqUgNCM9tbwmTdNHZRAnedOG+dV8QT+IC83nUume6 q7XfaSX+Q3LErrheSUfk5aaVOlaoTxCtosWWs= MIME-Version: 1.0 Received: by 10.151.108.2 with HTTP; Tue, 6 Apr 2010 23:17:55 -0700 (PDT) In-Reply-To: <4BBC1B89.5080405@bankir.ru> References: <4BBC1B89.5080405@bankir.ru> Date: Wed, 7 Apr 2010 00:17:55 -0600 Received: by 10.150.243.4 with SMTP id q4mr3930365ybh.310.1270621075239; Tue, 06 Apr 2010 23:17:55 -0700 (PDT) Message-ID: Subject: Re: Table Design for Hierarchical Data From: Scott Marlowe To: silly sad Cc: Lee Hachadoorian , pgsql-sql Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.74 tagged_above=-10 required=5 tests=BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 201004/15 X-Sequence-Number: 33942 On Tue, Apr 6, 2010 at 11:43 PM, silly sad wrote: > P.S. > almost foget, do not try any oracle-like "tree-jouns" or "special types" or > such a crap. > > your problem as plain as to store a pair of integers > (or numerics (i prefer)) Since it's an identifier and not really a numeric per se, I'd store it as text. I mean it could as easily be a 5 character alpha code as 5 character number code. With tet you can create indexes on substring(idfield,1,1), substring(idfield,1,2), substring(idfield,1,3), substring(idfield,1,4), and substring(idfield,1,5) for fast lookups and matching.