maria-developers team mailing list archive
Mailing list archive
Re: How to get all fields in a given index?
Thanks a lot!
On Tue, Sep 9, 2014 at 8:18 AM, Sergey Petrunia <sergey@xxxxxxxxxxx> wrote:
> On Mon, Sep 08, 2014 at 08:54:00PM +0100, Rongrong wrote:
> > I'm trying to implement some feature that requires to get the list of
> > fields for a given index. I'm trying to follow the optimizer code to find
> > some clue but am not successful so far. Can anyone give me some pointers?
> A TABLE object has a member called key_info. It is an array of structures
> describing each index.
> For an index $I, table->key_info[$I].usable_key_parts gives the number of
> parts that the optimizer considers (it varies depending on
> Then, table->key_info[$I].key_part is an array of structures describing key
> The most interesting are table->key_info[$I].key_part[$PART].field (the
> itself) and table->key_info[$I].key_part[$PART].fieldnr (field number).
> Alternatively, there is table->field[$FIELD_NO].part_of_key - this is a
> which tells which indexes this field is a part of.
> Sergei Petrunia, Software Developer
> MariaDB | Skype: sergefp | Blog: http://s.petrunia.net/blog