List:Internals« Previous MessageNext Message »
From:AugustQ Date:April 24 2013 9:59am
Subject:Re: adding an index of my own type/code
View as plain text  
Hi,

and thanks for your hints.

Here is what I did: I created a tiny storage engine which inherits its
functionality from MyIsam. I can load this code and so I created a table
with this type of storage engine.

Next I wanted to see what my storage engine can do if I add an index to
this table. 

If I create an index without specifying an index-type everything works.
In the ::create(()-function I see the columns that describe the index.

When I create an index using an index-engine-type by giving the keyword
engine or type or using in the CREATE-stmt, it works when I use one of
the keywords given in the description like BTREE or HASH. But when I
create an index using my own keyword then I got immediately the syntax
error.

In my example I used the word AQTREE for the description of the
index-engine. I wanted to see at the storage-engine-level, what
information was given to my code but this storage engine (my code) was
never called.

What I expected: MySQL offers the choice of adding another storage
engine without modifying the source code of MySQL itself. So I assumed
that this would include the creating and handling of an index.

Is this possible?

Thanks
AugustQ

Am Dienstag, den 23.04.2013, 09:28 -0700 schrieb Stewart Smith:
> AugustQ <augustq@stripped> writes:
> > I'm using the source-code of MySQL-version 5.5.8
> 
> You really want to use something more recent. 5.5.8 is ancient.
> 
> > I want to implement my own type of an index and play with it. How can I
> > do this?
> 
> You have to do this inside a storage engine, the MySQL server itself
> doesn't deal with indexing (although the optimizer obviously has some knowledge).
> 
> > It's easy to add a storage engine. For creating the index on a table I
> > use a statement like:
> >     create index PRIMA3 
> >     on ABDAOK(Id, PZN, ArtikelBez) 
> >     type  AQTREE;
> >
> > I go a syntax-error: ERROR 1064 (42000)
> >
> > What do I have to do to implement my own index-code? 
> 
> Pick an engine: MyISAM, Heap, InnoDB (default) or one of the third party
> ones and go for it. Getting any actual code merged into MySQL if you
> don't work for Oracle is... well... problematic at best.
> 
> If you're wanting to experiment with different indexing methods, it is
> possible that the PostgreSQL code is a better choice - and a higher
> chance of ever having code integrated.
> 
> You can, of course, write your own storage engine with whatever indexing
> methods you like (and just lie to the optimizer about it being like a
> BTREE :)
> 
> > Is there a newer version that supports this better?
> 
> No. Drizle takes away some of the server side issues, but it's still all
> the responsibility of the storage engine.
> 


Thread
adding an index of my own type/codeAugustQ23 Apr
  • Re: adding an index of my own type/codeStewart Smith23 Apr
    • Re: adding an index of my own type/codeAugustQ24 Apr
      • Re: adding an index of my own type/codeThomas Jones-Low24 Apr
      • Re: adding an index of my own type/codeSergei Golubchik24 Apr
        • Re: adding an index of my own type/codeAugustQ24 Apr