Thread View: borland.public.cppbuilder.database.ado
3 messages
3 total messages
Started by Vladimir Stefanovic
Thu, 31 May 2007 18:53
Creating composite primary-keys or indexes at run-time...
Author: Vladimir Stefanovic
Date: Thu, 31 May 2007 18:53
Date: Thu, 31 May 2007 18:53
31 lines
1831 bytes
1831 bytes
I have MS Access database/table with attributes: 1. Word (text) 2. Lang (bool) 3. Translation (text) It has 270,000 records. * Database without any indexes and PKs is about 17MB (6MB compressed) * Database *with* just indexes on Word and Lang is about 23MB (8MB compressed) * Database *with* PK on Word and Lang is about 23MB (8MB compressed) (I suppose that in this case indexes are made by default) SQL response is dramatically slower without indexes. I have to deploy this DB with the installation procedure, and I want to save this 2MB ( 8MB - 6MB ). The idea is to deploy the database without idexes and than make composite PK (Word+Lang), or just indexes on Word and Lang at run-time, during installation procedure. The question is how to make (composite in this case) PKs or indexes at run-time? I'm using ADO. -- Best Regards, Vladimir Stefanovic
Re: Creating composite primary-keys or indexes at run-time...
Author: Vassiliev V. V.
Date: Thu, 31 May 2007 19:12
Date: Thu, 31 May 2007 19:12
50 lines
2703 bytes
2703 bytes
Connect and execute SQL command: CREATE INDEX IX_MyIndex ON MyTable (Word, Lang) or, better, add new column ID counter and define PK on it. Counter is integer and index on it will require less space than index on string column. //------------------------------------------ Regards, Vassiliev V. V. http://www.managed-vcl.com - using .Net objects in Delphi for Win32 + ADO.Net http://www.oledbdirect.com - The fastest way to access MS SQL Server, MS Jet (Access) and Interbase (through OLEDB) "Vladimir Stefanovic" <antivari@po.sbb.co.yu> �������/�������� � �������� ���������: news:465f19ac@newsgroups.borland.com... >I have MS Access database/table with attributes: > > 1. Word (text) > 2. Lang (bool) > 3. Translation (text) > > It has 270,000 records. > > * Database without any indexes and PKs is about 17MB (6MB compressed) > * Database *with* just indexes on Word and Lang is about 23MB (8MB > compressed) > * Database *with* PK on Word and Lang is about 23MB (8MB compressed) > (I suppose that in this case indexes are made by default) > > SQL response is dramatically slower without indexes. > > I have to deploy this DB with the installation procedure, and I want to > save this 2MB ( 8MB - 6MB ). > > The idea is to deploy the database without idexes and than make composite > PK (Word+Lang), or just indexes on Word and Lang at run-time, during > installation procedure. > > The question is how to make (composite in this case) PKs or indexes > at run-time? I'm using ADO. > > > > -- > Best Regards, > Vladimir Stefanovic >
Re: Creating composite primary-keys or indexes at run-time...
Author: Vladimir Stefanovic
Date: Thu, 31 May 2007 19:37
Date: Thu, 31 May 2007 19:37
20 lines
1414 bytes
1414 bytes
> Connect and execute SQL command: > > CREATE INDEX IX_MyIndex ON MyTable (Word, Lang) > > or, better, add new column ID counter and define PK on it. > Counter is integer and index on it will require less space than index > on string column. Thank you very much! Haven't tested it though, but I do not doubt it will work. The idea with a new Integer PK column is great (I wonder how I overlooked such solution)! -- Best Regards, Vladimir Stefanovic
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads