| Edit | Rename | Changes | History | Upload | Download | Back to Top |
This comes from the same folks who put up the Store Schema Diagram.
See also wiki.cs.uiuc.edu/VisualWorks/Store+speedup+tips.
See also Store Schema Optimization (Views)
So I decided to focus on the second issue and see, if perchance, there was some way to tune the database server to execute the queries more efficiently. I was astonished to find that the Store installation defines only one index. It does define primary keys and most databases will automatically create indexes for primary keys. However, in practice most queries, such as selecting all the packages belonging to bundle or all the versions of a package of a given name, will not benefit at all from the primary key indexes. Ideally, the foreign key columns and columns such as "name" that are referenced in the where clauses of SQL statements should be indexed.
So I defined new indexes for all the tables in the Store database for all the foreign keys and "searchable" columns and created inverse unique indexes for all the associative tables (those used to create many to many relationships). Then I ran a test garbage collection on a single package both before adding the indexes and again afterwards. The results:
Time required to garbage collect the package with no indexes: 7 minutes and 49 seconds. Time required to garbage collect the package with indexes: 0 minutes and 6 seconds.
This test was performed on a local repostory (Personal Oracle on my Dell Laptop PIII). Your mileage may vary depending on a number of factor such as:
1) LAN/WAN communication. This test had none so as to isolate the affect of the indexes on the database server itself. In practice using a shared repository the improvement will not be as significant because the SQL queries and corresponding results, of which there are many, must travel accross the LAN/WAN.
(2) Database Server. Issues such as the effectiveness of the server's query optimizer, disk I/O speed, RAM etc will all have an affect.
I've installed these indexes on our team's shared respository. We have not seen any negative consequences of doing so although in theory this will increase the size of the databases and may slow down inserts and updates because of the need to also update the indexes. However, it should improve the performance of all selects, not just those associated with garbage collection. The overwhelming majority of queries are probably simple selects used to populate lists and such for the Store UI. We have seen noticable improvements in other things such as "Switch Database".
So I offer these indexes (see attachments) for any who would like to install them. And for those who would like to, it would be useful if you would share with the vw-dev subscribers some before and after feedback to see what operations and configurations benefit from them and which ones don't.
DROPNEWSTOREINDEXES.sql
NEWSTOREINDEXES.sql
NEWSTOREINDEXESWTS.sql
I've included a generic SQL script for use with any SQL database that will create the indexes. In addition, there is a version that includes a tablespace definition (for Oracle) that places the indexes in the Store tablespace. (A database optimization that is sometimes employed by some is to create a separate tablespace just for indexes and to place the files of that tablespace in a directory that is served by a different disk controller than the one serving the table data. That way index I/O and table data I/O are not competing with each other. If you want to do something like that feel free to alter the scripts as needed.) Finally, I've included a script to remove the indexes in case you don't find them beneficial.
The SQL Scripts:
I can vouch for these being highly useful; I had avoided using Store Garbage Collection for over two years before getting this enhancement!
PostgreSQL doesn't allow for ascending/descending indexes, so for that DB the 'ASC' keyword must be removed prior to defining the indexes. Pete Hatch
SQL Server
I don't really know what I'm doing, so applying this to Microsoft SQL Server took a little while. In case anybody else is in the same boat, here's what I found - experts please correct!
| Edit | Rename | Changes | History | Upload | Download | Back to Top |