Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 52183 invoked from network); 27 Jun 2005 16:26:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Jun 2005 16:26:17 -0000 Received: (qmail 69196 invoked by uid 500); 27 Jun 2005 16:26:15 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 69137 invoked by uid 500); 27 Jun 2005 16:26:15 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 69117 invoked by uid 99); 27 Jun 2005 16:26:14 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jun 2005 09:26:14 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [32.97.110.131] (HELO e33.co.us.ibm.com) (32.97.110.131) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jun 2005 09:26:14 -0700 Received: from westrelay02.boulder.ibm.com (westrelay02.boulder.ibm.com [9.17.195.11]) by e33.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id j5RGQAco405390 for ; Mon, 27 Jun 2005 12:26:10 -0400 Received: from [127.0.0.1] (dyn9072133044.usca.ibm.com [9.72.133.44]) by westrelay02.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j5RGQ4nX320254 for ; Mon, 27 Jun 2005 10:26:10 -0600 Message-ID: <42C02895.2000708@sbcglobal.net> Date: Mon, 27 Jun 2005 09:25:57 -0700 From: Mike Matrigali User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derby Development Subject: Re: [jira] Updated: (DERBY-392) Disable creating indexes on long varchar for bit data. Long varchar column doesn't allow creating indexes already. References: <1657793075.1119765240347.JavaMail.jira@ajax.apache.org> In-Reply-To: <1657793075.1119765240347.JavaMail.jira@ajax.apache.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N "ineffective" is an understatement. Inserting a value that is bigger than 1/2 of a page will cause the insert to fail - with some sort of key too big error. Current btree mechanism does not support keys bigger than 1/2 of a page. Many systems get around this by only indexing the first N bytes/chars (I think 512 bytes is the mySQL value of N), of the datatype. Derby does not have this support, but could be implemented. Building and maintaining such an index would be easy. Some work would have to be done in the language layer to teach it that the value in the index key could only be used for indexing into the actual value in the base row, it could never be used as a covering key. No changes would be necessary at the store btree level, as it does not really know what it is storing. Satheesh Bandaram (JIRA) wrote: > [ http://issues.apache.org/jira/browse/DERBY-392?page=all ] > > Satheesh Bandaram updated DERBY-392: > ------------------------------------ > > Description: > I guess I did not articulate my reasons for suggesting removal of index support for 'long varchar for bit data' completely. > > 1) Long varchar types are not comparable... If they are not comparable, it should not be possible to use them in GROUP BY, ORDER BY or allow regular B-Tree indexes. > 2) Also, long varchar types tend to be long in size and hence the regular B-Tree mechanism is not a suitable way to index them. Dan also mentioned they become ineffective for keys longer than half a page size. > > It should not be possible to create an index on 'long varchar for bit data' datatypes. Derby currently doesn't allow creating indexes on 'long varchar' datatypes and the same should apply for it's bit data equivalent too. > > ij> create table longchar ( i int, c long varchar); > 0 rows inserted/updated/deleted > ij> create index longIdx on longchar(c); > ERROR X0X67: Columns of type 'LONG VARCHAR' may not be used in CREATE INDEX, ORD > ER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because compari > sons are not supported for that type. > ij> create table longcharBitData ( i int, c long varchar for bit data); > 0 rows inserted/updated/deleted > ij> create index longIdx on longcharBitData(c); > 0 rows inserted/updated/deleted > > Derby also seems to allow GROUP BY and/or ORDER BY on LONG VARCHAR FOR BIT DATA types. I believe this is incorrect too. > select c from longcharBitData group by c; > C > > -------------------------------------------------------------------------------- > ------------------------------------------------ > > 0 rows selected > ij> select c from longcharBitData group by c order by c; > C > > -------------------------------------------------------------------------------- > ------------------------------------------------ > > 0 rows selected > > was: > It should not be possible to create an index on 'long varchar for bit data' datatypes. Derby currently doesn't allow creating indexes on 'long varchar' datatypes and the same should apply for it's bit data equivalent too. > > ij> create table longchar ( i int, c long varchar); > 0 rows inserted/updated/deleted > ij> create index longIdx on longchar(c); > ERROR X0X67: Columns of type 'LONG VARCHAR' may not be used in CREATE INDEX, ORD > ER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because compari > sons are not supported for that type. > ij> create table longcharBitData ( i int, c long varchar for bit data); > 0 rows inserted/updated/deleted > ij> create index longIdx on longcharBitData(c); > 0 rows inserted/updated/deleted > > > >>Disable creating indexes on long varchar for bit data. Long varchar column doesn't allow creating indexes already. >>------------------------------------------------------------------------------------------------------------------ >> >> Key: DERBY-392 >> URL: http://issues.apache.org/jira/browse/DERBY-392 >> Project: Derby >> Type: Bug >> Components: SQL >> Versions: 10.0.2.2, 10.1.1.0 >> Environment: generic >> Reporter: Satheesh Bandaram >> Priority: Minor > > >>I guess I did not articulate my reasons for suggesting removal of index support for 'long varchar for bit data' completely. >> >> 1) Long varchar types are not comparable... If they are not comparable, it should not be possible to use them in GROUP BY, ORDER BY or allow regular B-Tree indexes. >> 2) Also, long varchar types tend to be long in size and hence the regular B-Tree mechanism is not a suitable way to index them. Dan also mentioned they become ineffective for keys longer than half a page size. >>It should not be possible to create an index on 'long varchar for bit data' datatypes. Derby currently doesn't allow creating indexes on 'long varchar' datatypes and the same should apply for it's bit data equivalent too. >>ij> create table longchar ( i int, c long varchar); >>0 rows inserted/updated/deleted >>ij> create index longIdx on longchar(c); >>ERROR X0X67: Columns of type 'LONG VARCHAR' may not be used in CREATE INDEX, ORD >>ER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because compari >>sons are not supported for that type. >>ij> create table longcharBitData ( i int, c long varchar for bit data); >>0 rows inserted/updated/deleted >>ij> create index longIdx on longcharBitData(c); >>0 rows inserted/updated/deleted >>Derby also seems to allow GROUP BY and/or ORDER BY on LONG VARCHAR FOR BIT DATA types. I believe this is incorrect too. >>select c from longcharBitData group by c; >>C >>-------------------------------------------------------------------------------- >>------------------------------------------------ >>0 rows selected >>ij> select c from longcharBitData group by c order by c; >>C >>-------------------------------------------------------------------------------- >>------------------------------------------------ >>0 rows selected > >