Re: alternative to slow query

2012-07-17 Thread brian
On 12-07-16 06:57 PM, Rick James wrote: Plan A: Would the anti-UNION problem be solved by hiding the UNION in a subquery? The outer query would simply return what the UNION found. Of course! Yes, problem solved. Plan B: Insert every row twice into expression_expression -- (e1,e2) and also

RE: alternative to slow query

2012-07-16 Thread Rick James
Subject: Re: alternative to slow query On 12-07-03 02:18 PM, Stillman, Benjamin wrote: Not sure why it wouldn't show primary as a possible key then... Yes, that seems rather strange. From your first email: *** 1. row

Re: alternative to slow query

2012-07-03 Thread brian
On 12-07-02 09:33 PM, yoku ts wrote: Hello, add index to expression1_id and expression2_id on expression_expression. it doesn't use index,following, WHERE ee2.expression1_id = $ID OR ee1.expression2_id = $ID Thank you for your reply. The table already has indexes on

RE: alternative to slow query

2012-07-03 Thread Stillman, Benjamin
I don't see an index for expression.id. -Original Message- From: brian [mailto:mysql-l...@logi.ca] Sent: Tuesday, July 03, 2012 12:28 PM To: mysql@lists.mysql.com Subject: Re: alternative to slow query On 12-07-02 09:33 PM, yoku ts wrote: Hello, add index to expression1_id

Re: alternative to slow query

2012-07-03 Thread brian
On 12-07-03 01:13 PM, Stillman, Benjamin wrote: I don't see an index for expression.id. mysql db_lexi show index from expression\G *** 1. row *** Table: expression Non_unique: 0 Key_name: PRIMARY Seq_in_index: 1 Column_name: id

RE: alternative to slow query

2012-07-03 Thread Stillman, Benjamin
: brian [mailto:mysql-l...@logi.ca] Sent: Tuesday, July 03, 2012 1:47 PM To: mysql@lists.mysql.com Subject: Re: alternative to slow query On 12-07-03 01:13 PM, Stillman, Benjamin wrote: I don't see an index for expression.id. mysql db_lexi show index from expression\G *** 1

Re: alternative to slow query

2012-07-03 Thread brian
On 12-07-03 02:18 PM, Stillman, Benjamin wrote: Not sure why it wouldn't show primary as a possible key then... Yes, that seems rather strange. From your first email: *** 1. row *** id: 1 select_type: SIMPLE

alternative to slow query

2012-07-02 Thread brian
I have a table that joins on itself through a second table: table expression: id INT PRIMARY KEY, lang_id INT term VARCHAR(128) table expression_expression: id INT PRIMARY KEY expression1_id INT expression2_id INT In order to find associated records, I had originally used a UNION, which

Re: alternative to slow query

2012-07-02 Thread yoku ts
Hello, add index to expression1_id and expression2_id on expression_expression. it doesn't use index,following, WHERE ee2.expression1_id = $ID OR ee1.expression2_id = $ID regards, 2012/7/3 brian mysql-l...@logi.ca I have a table that joins on itself through a second