Skip to main content
5 events
when toggle format what by license comment
Dec 9, 2014 at 17:07 vote accept user664303
Dec 9, 2014 at 16:12 comment added FrustratedWithFormsDesigner @user664303: That depends on your database. Most databases will automatically create an index on your primary key. If you know that most of your queries will also reference both user_id AND event_id, you might want to create an index that contains both columns. You could also probably create two separate indicies, one for each column. Your best bet might be to populate the table with test data, run your queries and analyze the performance and query plans to determine the best way to create indices.
Dec 9, 2014 at 15:42 comment added user664303 It could be. The query time is the important thing. JNK mentioned appropriate indexes. Are these maintained automatically by the database, once created? Sorry for the newbie questions.
Dec 9, 2014 at 15:26 comment added JNK This is the obvious solution. As far as scalability, as long as appropriate indexes exist this should be very quick to query.
Dec 9, 2014 at 15:25 history answered FrustratedWithFormsDesigner CC BY-SA 3.0