Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 12480 invoked from network); 2 Nov 2006 15:26:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Nov 2006 15:26:31 -0000 Received: (qmail 54289 invoked by uid 500); 2 Nov 2006 15:26:42 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 54255 invoked by uid 500); 2 Nov 2006 15:26:41 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 54244 invoked by uid 99); 2 Nov 2006 15:26:41 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Nov 2006 07:26:41 -0800 X-ASF-Spam-Status: No, hits=2.8 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,MAILTO_TO_SPAM_ADDR,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of elecharny@gmail.com designates 64.233.162.203 as permitted sender) Received: from [64.233.162.203] (HELO nz-out-0102.google.com) (64.233.162.203) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Nov 2006 07:26:27 -0800 Received: by nz-out-0102.google.com with SMTP id z3so129641nzf for ; Thu, 02 Nov 2006 07:26:05 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=l27zQh+A4Vtd56CgmGImF2gHRgKndrGfrQxx6IjEv1+ja0P0r6qVHjUB3/7A85PEczZXW+b+KqVA7Frp2cLOQBM3XQashL2kkn95+oRlOKu38WvJ4p5PpV3G6yE+sezcjN98KFRnDfSp5Y8gZMoNoL0buPI7KwJ5GduzNi3Z2Rs= Received: by 10.65.253.6 with SMTP id f6mr963895qbs.1162481165491; Thu, 02 Nov 2006 07:26:05 -0800 (PST) Received: by 10.65.95.7 with HTTP; Thu, 2 Nov 2006 07:26:04 -0800 (PST) Message-ID: Date: Thu, 2 Nov 2006 16:26:04 +0100 From: "Emmanuel Lecharny" Reply-To: elecharny@apache.org To: "Apache Directory Developers List" Subject: Re: ApacheDS partition implementation based on Relational Model In-Reply-To: <454A05A2.5010100@bellsouth.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6267_29034990.1162481164931" References: <454A05A2.5010100@bellsouth.net> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_6267_29034990.1162481164931 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 11/2/06, Alex Karasulu wrote: > > Ersin Er wrote: > > How can we map Attributes to SQL model? > > There are probably a few ways to do this but some will be much faster > however the faster it is the uglier it will be. > > One way is to have one big table with the following columns: > > 1). ENTRY (BLOB) > 2). NDN (VARCHAR) > 3). UPDN (VARCHAR) > 4). ID (INTEGER) Well, from a RDBMS point of view, I think that a correct structure will be something like : A first table, ENTRY_T, with those columns : DN : varchar (but may be an id, which will refer to another table) ATTR : attribute name, varchar and an ATTRIBUTES_T table : DN : varchar ATTR : varchar VALUE : blob The idea is that yoiu will set index on those table, so you don't need anymore to declare NDN. For instance, if you want to get all attribute values for an entry, then th= e request will looks like : select DN, ATTR, VALUES from ATTRIBUTES_T where DN =3D %dn% (%dn% stand for the DN you are looking for) Now, if you want all the entries which cn =3D ACME, the request will be : select DN, ATTR, VALUES from ATTRIBUTES_T where DN in (select DN from ATTRIBUTES_T where ATTR =3D 'cn' and VALUE =3D 'ACME') Just set the correct index to have good performances ! (this is just a first approach, we need to improve it a _lot_) I have put some thought related to backend organization here : http://docs.safehaus.org/display/APACHEDS/Backend but it needs to be further a lot ! You can lookup entries that are blobs this way by normalized (NDN) and > user provided distinguished names (UPDN) as well as by ID. > > If you want to index a specific attribute use some DDL to add a new > COLUMN to this table. That column should be the name of the attribute > being (LDAP not DB) indexed. Do a full table scan the first time and > populate this new "index" COLUMN with the values of the attribute. > > Handling queries now is not that complex. Basically you need to > determine which attributes you have indices on and which you don't. > Then do a query to select and narrow down the rows that you'll have to > resusitate the entry from the blob from. > > You might need another table for an existance index too. The EXISTANCE > table might have a ATTRIBUTE column, and ID column. If a record exists > in this table for an attribute your blobed entry then has a value for > this attribute. > > Should we hold Attribute > > Values in blobs? > > You will need to hold the entry in a blob. Well, you have two options : varchar for simple and limited entries (but varchar can't be larger than, say, 256 chars, which may become a problem, o= r blobs, for binary elements or big chars. That's a pitty because blobs sucks when you want to set index on them. > Can we leverage the power of SQL SELECT for LDAP search operations? > > Sure. You just need to know how to build the WHERE clause of SQL using > this simple schema. > > > How much of the partition code in ADS can be used for this task? > > Not much. Yes, this will be really one of our biggest problem. Alex > > --=20 Cordialement, Emmanuel L=E9charny ------=_Part_6267_29034990.1162481164931 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
On 11/2/06, Alex Karasulu <aok123@be= llsouth.net> wrote:
Ersin Er wrote:
<snip/>> How can we map Attributes to SQL model= ?

There are probably a few ways to do this but some will be much fas= ter
however the faster it is the uglier it will be.

One way is to= have one big table with the following columns:

1). ENTRY (BLOB)
2). NDN (VARCHAR)
3). UPDN (VARCHAR)
4). = ID (INTEGER)

Well, from a RDBMS point of view, I think= that a correct structure will be something like  :
A first table, = ENTRY_T, with those columns :

DN : varchar (but may be an id, which will refer to another table)<= br>ATTR : attribute name, varchar

and an ATTRIBUTES_T table :
DN = : varchar
ATTR : varchar
VALUE : blob

The idea is that yoiu wi= ll set index on those table, so you don't need anymore to declare NDN.
For instance, if you want to get all attribute values for an entry, the= n the request will looks like :
select DN, ATTR, VALUES from ATTRIBUTES_= T where DN =3D %dn%

(%dn% stand for the DN you are looking for)

Now, if you want all the entries which cn =3D ACME, the request will be= :

select DN, ATTR, VALUES from ATTRIBUTES_T where DN in (select DN = from ATTRIBUTES_T where ATTR =3D 'cn' and VALUE =3D 'ACME')

Just set= the correct index to have good performances !

(this is just a first approach, we need to improve it a _lot_)
<= br>I have put some thought related to backend organization here : http://docs.safehaus= .org/display/APACHEDS/Backend
but it needs to be further a lot !

You can lookup entries that are bl= obs this way by normalized (NDN) and
user provided distinguished names (UPDN) as well as by ID.

If yo= u want to index a specific attribute use some DDL to add a new
COLUMN to= this table.  That column should be the name of the attribute
= being (LDAP not DB) indexed.  Do a full table scan the first time= and
populate this new "index" COLUMN with the values of the attri= bute.

Handling queries now is not that complex.  Basically= you need to
determine which attributes you have indices on and which yo= u don't.
Then do a query to select and narrow down the rows that you'll have to<= br>resusitate the entry from the blob from.

You might need another t= able for an existance index too.  The EXISTANCE
table might ha= ve a ATTRIBUTE column, and ID column.  If a record exists
in this table for an attribute your blobed entry then has a value forthis attribute.

Should we hold Attribute
> Values in blobs?<= br>
You will need to hold the entry in a blob.

Well, you have two options : varchar for simple and limited entries (but va= rchar can't be larger than, say, 256 chars, which may become a problem, or = blobs, for binary elements or big chars. That's a pitty because blobs sucks= when you want to set index on them.

>= ; Can we leverage the power of SQL SELECT for LDAP search operations?
Sure.  You just need to know how to build the WHERE clause of SQL= using
this simple schema.

> How much of the partition code in= ADS can be used for this task?

Not much.

Yes, = this will be really  one of our biggest problem.=20

Ale= x




--
Cordialement,<= br> Emmanuel L=E9charny ------=_Part_6267_29034990.1162481164931--