MySQL Forums
Forum List  »  Full-Text Search

how this query works?
Posted by: Saurabh Arora
Date: September 04, 2011 11:48AM

Hi

Query 1 - >

Select bla from (
select bla from tablename1 where id='1234' Limit 1
Union
select bla from tablename2 where id='1234' Limit 1
Union
select bla from tablename3 where id='1234' Limit 1
) Limt 1

Q-> how does this query actually executes? Does it stop executing when it finds that 1 row and returns the result immediately???
if not, how should i write a query that gives me 1 row of data i need as soon as it finds it in the tables i am searching.


Query 2-
Select count(*), match(col) against(val) from (
select bla from tablename1 where match(col) against(val) Limit 15
Union
select bla from tablename2 where match(col) against(val) Limit 15
Union
select bla from tablename3 where match(col) against(val) Limit 15
) Limt 15


What does this query exactly do and how does this execute?

Thanks a ton.
Saurabh.


P.S - > comments on optimizing these queries for table rows >50K are most welcome.

Options: ReplyQuote


Subject
Views
Written By
Posted
how this query works?
4078
September 04, 2011 11:48AM
1827
September 07, 2011 10:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.