question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DB index for deleted

See original GitHub issue

Would you welcome a PR to change SafeDeleteModel.deleted into something like this?

deleted = models.DateTimeField(editable=False, null=True, db_index=SAFE_DELETED_DB_INDEX)

where SAFE_DELETED_DB_INDEX will be optionally configurable via django settings (default to False for backwards compatibility).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
panhaoyucommented, Aug 16, 2022

Nice work, and I think the default index is useful.

For a table with about 20K lines, just a simple query will cause about 5s, which is not acceptable, and 20K is not a large dataset.

As a user, I want to install the lib and do no harm to our previous work, however, the performance does harm the work, and I have to dive into the source code to find the index. I think making it default is more intuitional.

Anyway, thanks for your work, nice lib!

0reactions
Gagarocommented, Aug 17, 2022

Yes, but it was still ‘deleted’ for the index and the one defined in the setting for the field name in the tests. I’m not sure why.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Delete an Index - SQL Server | Microsoft Learn
To delete an index by using Object Explorer · In Object Explorer, expand the database that contains the table on which you want...
Read more >
More indexes, slower DELETE - Use The Index, Luke
The more indexes you add to a table, the slower DELETE becomes. Exception: PostgreSQL due to its MVCC approach.
Read more >
Indexing for Deletes - Brent Ozar Unlimited®
If you're only indexing to make reads faster, you need to think again. Indexes can make every operation in the database faster, even...
Read more >
SQL DROP INDEX - W3Schools
The DROP INDEX command is used to delete an index in a table. MS Access: DROP INDEX index_name ON table_name;. SQL Server:.
Read more >
How to safely remove database indexes (without bringing ...
Safely remove database indexes by disabling them. This improves application perforamnce. Works for MySQL, MariaDB, PostgreSQL, Microsoft SQL ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found