Re: [SQL] Two optimization questions

2006-09-12 Thread Mezei Zoltán
Aaron Bono wrote: You could split it into sub-queries but would that make the performance better or worse? I guess it depends on how much data is there, and what frequency you have ot the event_type's but indexing the event_type column would help. This may be worth a try - use EXPLAIN to see

Re: [SQL] Two optimization questions

2006-09-12 Thread Aaron Bono
On 9/12/06, Mezei Zoltán <[EMAIL PROTECTED]> wrote: Hi,I think it can be done better than I did and I want to learn...1. I have a table that registers the history of messages:output_message_history(id, event_type, event_time)I need those ID-s from the table where there is one 'MESSAGE SENT' event a

[SQL] Two optimization questions

2006-09-12 Thread Mezei Zoltán
Hi, I think it can be done better than I did and I want to learn... 1. I have a table that registers the history of messages: output_message_history(id, event_type, event_time) I need those ID-s from the table where there is one 'MESSAGE SENT' event and one 'MESSAGE SUBMITTED' event and there