|
Ok, on your first question: Deleting after a certain time has passed.
There are a number of ways of doing this. Probably the easiest from a conceptual point of view is to add in a time field and then execute an appropriate command to delete based on the value of the field.
Now, as for database speed.
A database is a collection of data. It does not necessarily have "speed" as it's an object, per se. Speed comes into play when you attempt to ask the database a question via a query. Subsequently, your question ought to be "How do I determine how fast a query is?" The answer for MySQL is to use EXPLAIN. What I found interesting about EXPLAIN is that when I first learned to use it, I'd try EXPLAIN with a small set of data. When I read the "MySQL Database Design and Tuning" book, however, I noticed that they first inserted lot's of rows (in the millions) before executing EXPLAIN. The rows inserted, while being randomly generated, had the same characteristics that real data inserted into the database would have in order to make the results of the EXPLAIN more relevant (oftentimes providing drastically different results than the EXPLAIN on a smaller set of data). Now, the results of EXPLAIN have to be interpreted carefully and I recommend checking out the MySQL site or getting their book for greater insight. Additionally, it's very interesting to note that the latest version of MySQL is much more efficient at executing the same query than previous versions of MySQL (for example, through more efficient use of indices), so upgrading MySQL may decrease your query's execution time.
|