Re: how to use index with order by here

2008-03-18 Thread Rob Wultsch
On Mon, Mar 17, 2008 at 11:35 PM, Sebastian Mendel <[EMAIL PROTECTED]> wrote: > hu? ... i am pretty sure i had a similar problem, i solved this by adding > the column with the order to the index, which 'solved' the filesort (except > the ORDER is in reverse) I don't think we can lose the filesor

Re: how to use index with order by here

2008-03-17 Thread Sebastian Mendel
Rob Wultsch schrieb: On Mon, Mar 17, 2008 at 4:36 AM, Arthur Fuller <[EMAIL PROTECTED]> wrote: I love when this happens. I woke in the middle of the night with an idea for you. It now occurs to me that the query you want is dead simple. It just took me a while to see: SELECT * FROM messages

Re: how to use index with order by here

2008-03-17 Thread Rob Wultsch
On Mon, Mar 17, 2008 at 4:36 AM, Arthur Fuller <[EMAIL PROTECTED]> wrote: > I love when this happens. I woke in the middle of the night with an idea for > you. It now occurs to me that the query you want is dead simple. It just > took me a while to see: > > SELECT * > FROM messages > > WHERE id

Re: how to use index with order by here

2008-03-17 Thread Arthur Fuller
I love when this happens. I woke in the middle of the night with an idea for you. It now occurs to me that the query you want is dead simple. It just took me a while to see: SELECT * FROM messages WHERE id_from = 1 AND id_to = 2 UNION SELECT * FROM messages WHERE id_from = 2 AND id_to = 1 ORDER BY

Re: how to use index with order by here

2008-03-17 Thread Sebastian Mendel
Rob Wultsch schrieb: On Sat, Mar 15, 2008 at 2:42 PM, Nacho Garcia <[EMAIL PROTECTED]> wrote: Hi, im having troubles with one query, hope someone can help. on this table: messages: id_fromint(10) id_toint(10) textvarchar(1000) time with index on id_form and id_to i want t

Re: how to use index with order by here

2008-03-16 Thread Rob Wultsch
On Sun, Mar 16, 2008 at 10:36 AM, Velen <[EMAIL PROTECTED]> wrote: > I would suggest u use > > SELECT * > FROM messages > WHERE id_from between 1 and 2 > AND id_to between 1 and 2 > ORDER BY time That would only be applicable if he mandated that his users only send messages to other user

Re: how to use index with order by here

2008-03-16 Thread Velen
I would suggest u use SELECT * FROM messages WHERE id_from between 1 and 2 AND id_to between 1 and 2 ORDER BY time Hope this helps. Velen - Original Message - From: "Nacho Garcia" <[EMAIL PROTECTED]> To: Sent: Sunday, March 16, 2008 1:42 AM Subject: how to use index with order b

Re: how to use index with order by here

2008-03-15 Thread Rob Wultsch
On Sat, Mar 15, 2008 at 2:42 PM, Nacho Garcia <[EMAIL PROTECTED]> wrote: > Hi, im having troubles with one query, hope someone can help. > > on this table: > > messages: > id_fromint(10) > id_toint(10) > textvarchar(1000) > time > > with index on id_form and id_to > > i want to