Google Summer of Code Updates - Class based indexes

781 views
Skip to first unread message

akki

unread,
Jun 12, 2016, 7:25:58 AM6/12/16
to Django developers (Contributions to Django itself)
Hi

Here is the list of tasks that I have done related to my GSoC project till now.
  • Introducing the django.db.models.indexes module.
    • Writing the BaseIndex class - kind of skeleton for all the index classes.
    • Writing the Index class for the default (B-Tree) indexes.
  • Add CreateIndex/DropIndex migration operation for adding and removing the indexes.
  • Add methods to schema for the same.
  • Writing corresponding tests for migrations and schema.
  • Create docs for indexes and the new operations.

#26709 is the ticket  corresponding to the current checkpoint. The code can be found at https://github.com/django/django/pull/6726.


Regards
Akshesh (akki)

akki

unread,
Jun 20, 2016, 2:12:18 PM6/20/16
to Django developers (Contributions to Django itself)
Progress on previous PR:
  • Design changes in ModelState.options.indexex and RemoveIndex migration
  • Improved algorithm for index naming
  • Other cleanups and cosmetic changes

Other than that I have started working on the second checkpoint as well which is to add support for creating class based index in the Meta class. The code can be seen at https://github.com/akki/django/pull/1/


Regards
akki

akki

unread,
Jun 27, 2016, 12:50:44 PM6/27/16
to Django developers (Contributions to Django itself)

This week's work on previous PR:
  • Change in signature of Index class
  • Write tests for the Index class
  • Address all issues on PR
The previous PR has been merged. Now indexes can be added using the AddIndex migration.


The next checkpoint is to add support for using Index classes from model's Meta class. Corresponding ticket - #26808. The code is almost ready, I will be sending a pull request soon.

thinkwel...@gmail.com

unread,
Jun 27, 2016, 5:02:06 PM6/27/16
to Django developers (Contributions to Django itself)
Will it be possible to create indexes other than btree? In reviewing the code it doesn't look like it but I hope I'm wrong. It'd be awesome to support the many more specific index options without using run_sql.

Tim Graham

unread,
Jun 27, 2016, 6:51:31 PM6/27/16
to Django developers (Contributions to Django itself)
Support for more index types is planned. This is only part 1 of the work. Please see https://gist.github.com/akki/7fd50505928dac58dc350e6cb186a404 for the timeline.

thinkwel...@gmail.com

unread,
Jun 28, 2016, 9:14:37 AM6/28/16
to Django developers (Contributions to Django itself)
Wonderful!  I make heavy use of btree_gin in one of my projects; will be great to have these new Index classes!

akki

unread,
Jul 5, 2016, 2:24:00 AM7/5/16
to Django developers (Contributions to Django itself)
  • Restructure index migrations
    PR  - https://github.com/django/django/pull/6866
    Modified the internal working of migrations/schema methods related to indexes. This mainly aims at stabilising the newly added migrations for Index class.

akki

unread,
Jul 12, 2016, 4:47:21 AM7/12/16
to Django developers (Contributions to Django itself)
  • Restructure index migrations - Polished according to all reviews, the PR has been merged.
  • Introduce Meta.indexes - Updated PR according to suggestions as per reviews.
  • Improve schema's index name creating algorithm - #24442 !6898.
  • Add support for indexes to inspectdb - This depends on !6857 so I will send a PR once indexes are added to Meta class; Current work on my local branch - https://github.com/akki/django/commits/gsoc-indexes-inspectdb

akki

unread,
Jul 19, 2016, 1:11:16 AM7/19/16
to Django developers (Contributions to Django itself)

akki

unread,
Jul 25, 2016, 9:28:57 PM7/25/16
to Django developers (Contributions to Django itself)

  • Fixed #24442 - Improved schema's index name creating algorithm
    Updated !6898 to take all column names into account while creating index name
  • Add support for column ordering (ASC/DESC) in class based indexes
    Somewhat provides the feature requested in #20888
    WIP code on my branch - https://github.com/akki/django/commits/gsoc-indexes-order
    Modifying introspection of all databases to return column order as well (required for testing) -- implementation for Oracle remaining.
  • Implement Hash index class
    WIP implementation at https://github.com/akki/django/commits/gsoc-indexes-hash
    Currently implemented only for postgresql because that's the only backend which fully supports it AFAIK (MySQL supports for some storage engines but neither for MyISAM nor InnoDB).

Jani Tiainen

unread,
Jul 26, 2016, 7:17:32 AM7/26/16
to django-d...@googlegroups.com
Hi,


On 26.07.2016 04:28, akki wrote:

  • Fixed #24442 - Improved schema's index name creating algorithm
    Updated !6898 to take all column names into account while creating index name
  • Add support for column ordering (ASC/DESC) in class based indexes
    Somewhat provides the feature requested in #20888
    WIP code on my branch - https://github.com/akki/django/commits/gsoc-indexes-order
    Modifying introspection of all databases to return column order as well (required for testing) -- implementation for Oracle remaining.

If you get stuck with Oracle I can lend a hand to help to figure out the details.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/be05e9f0-ed44-4c73-aa41-b02349584e29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Jani Tiainen

akki

unread,
Jul 27, 2016, 10:56:38 AM7/27/16
to Django developers (Contributions to Django itself)
Hi Jani

Thanks a lot for offering help. I did face some issues with the Oracle setup in the beginning but was able to resolve them yesterday. :)
You are most welcomed to review the PR and offer any suggestions for improvement at https://github.com/django/django/pull/6982/. The work related to the feature is in progress but the introspection-related work is mostly complete.

Regards
Akshesh(akki)

akki

unread,
Aug 2, 2016, 1:42:27 AM8/2/16
to Django developers (Contributions to Django itself)
  • Add support for column ordering (ASC/DESC) in class based indexes
Other than these, I also had a look at btree_gin indexes and extensions but haven't started the implementation yet.

akki

unread,
Aug 8, 2016, 4:00:54 PM8/8/16
to Django developers (Contributions to Django itself)

akki

unread,
Aug 16, 2016, 8:09:34 AM8/16/16
to Django developers (Contributions to Django itself)
  • Add support for column ordering (ASC/DESC) in class based indexes - !6982#20888

thinkwel...@gmail.com

unread,
Aug 16, 2016, 8:46:22 AM8/16/16
to Django developers (Contributions to Django itself)
Thank you, akki, for this project! Have enjoyed following your progress. It'll be something I'm going to make significant use of.

akki

unread,
Aug 21, 2016, 8:50:35 AM8/21/16
to Django developers (Contributions to Django itself)
Hi

The GSoC 2016 period has almost reached it's completion and I have completed my submission. You can find my work submission here - https://gist.github.com/akki/f45c7cf5db30c025f49d862d82dd259a.

I enjoyed a lot working on this project and am very excited about everyone making use of class based indexes. There is some work remaining which would be helpful to extend support for other index types and add new index classes. I will continue working on it and try to finish it soon. Meanwhile, you can use the current indexes from the master repo i.e. development version (and report bugs/provide feedback).

Many thanks to everyone for their involvement and valuable suggestions throughout the summer. :)

Cheers
akki

Josh Smeaton

unread,
Aug 21, 2016, 7:33:04 PM8/21/16
to Django developers (Contributions to Django itself)
Great work Akki! I know there hasn't been a lot of activity on this thread, but I'm really looking forward to using the new indexing features, and I bet there are a lot of others. It's also been fun to follow along with your progress as you've been pushing many smaller commits rather than one giant one at the end. From where I sit this looks like an extremely successful GSOC project, well done!

Cheng Chi

unread,
Aug 21, 2016, 9:53:50 PM8/21/16
to Django developers (Contributions to Django itself)

Great work, akki!


I think you should add it to 1.11 Changelog as major new feature, and add yourself to authors list as well.

akki

unread,
Aug 23, 2016, 11:29:23 PM8/23/16
to Django developers (Contributions to Django itself)
Thanks a lot Josh! Actually it was this mail sent by you that made me interested in this idea and later take it up as a project for GSoC, so a big THANK YOU to you. :)


Great work, akki!


I think you should add it to 1.11 Changelog as major new feature, and add yourself to authors list as well. 

 

Thanks. I have sent a PR to add it to the release docs, you can have a look at it at https://github.com/django/django/pull/7144.

Reply all
Reply to author
Forward
0 new messages