Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to add column indexes #27

Closed
simonw opened this issue Jan 8, 2021 · 5 comments
Closed

Ability to add column indexes #27

simonw opened this issue Jan 8, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Jan 8, 2021

No description provided.

@simonw simonw added the enhancement New feature or request label Jan 8, 2021
@simonw
Copy link
Owner Author

simonw commented Sep 9, 2023

This is quite an advanced feature. Should it support compound indexes? I think so, but the UI for those is tricky.

@simonw
Copy link
Owner Author

simonw commented Sep 9, 2023

Presumably it should prevent people from creating the same index multiple times - or does SQLite already either prevent that or quietly just create a single index?

@simonw
Copy link
Owner Author

simonw commented Oct 25, 2023

I'm going to allow adding indexes on single columns, with an option to make them unique. I'll add drop index too.

@simonw
Copy link
Owner Author

simonw commented Oct 25, 2023

I'm seeing these two indexes on a table that I ran this against:

CREATE INDEX o_order_date ON Orders (order_date);
[
  Index(seq=0, name='o_order_date', unique=0, origin='c', partial=0, columns=['order_date']),
  Index(seq=1, name='sqlite_autoindex_Orders_1', unique=1, origin='pk', partial=0, columns=['id'])
]

I probably shouldn't let people drop those sqlite_autoindex_Orders_1 indexes - best information I found about them was this thread: https://sqlite.org/forum/info/f16f8ed8666c5e97

@simonw
Copy link
Owner Author

simonw commented Oct 25, 2023

CREATE INDEX blah_customer_id 
ON Orders (customer_id, order_date, status);

CREATE UNIQUE INDEX idx_orders_unique 
ON Orders (order_id, order_date);

Page now looks like this:

CleanShot 2023-10-25 at 14 12 04@2x

simonw added a commit that referenced this issue Oct 26, 2023
simonw added a commit that referenced this issue Oct 26, 2023
simonw added a commit that referenced this issue Oct 26, 2023
@simonw simonw closed this as completed in 9223b16 Oct 26, 2023
simonw added a commit that referenced this issue Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant