Instruction
Good job! Now, imagine the following situation: You have a table with lots of data and a few indexes. You have to update most of the rows in the table, and you're afraid that updating the indexes will take a really long time. What to do?
A frequent trick used by database developers is to first delete all existing indexes, then update the data, and finally create the indexes again. This way, the database will only have to create the indexes once, instead of modifying the structure of existing indexes for each update operation.
A small reminder: When you have an index created in this way ...
CREATE INDEX count_day_index ON passenger_count(day);
... you can delete it using:
DROP INDEX count_day_index;
Exercise
We've found an error in the issue dates of most of the invoices in the table invoice:
CREATE TABLE invoice ( id integer PRIMARY KEY, number varchar(18) UNIQUE, issue_date date, customer_id integer, amount decimal(10, 2), currency char(3) );
We'll want to update most of the table's rows, but we need your help first. Delete the index you previously created, issue_date_index.
Stuck? Here's a hint!
Start with:
DROP INDEX ...



