I was wondering... (a newbie starting to understand how to optimize
queries)
In which step of query execution the LIMIT clause is executed? I mean
I have a query that would return, let's say, 6 rows, but I add a "LIMIT
1" in the end of it.
I would speed up things because I would have less data fetching from
the database, right?
But let's go to a extreme case. I just want to check if a query
returns data at all, so I did the following query:
select 1 from <tablename>
Seems fair, right? And what would be the difference in query
optimization if I did the following (i know i'm doing strange stuff):
select 1 from <tablename> limit 1
--
Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893
Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone/Fax.: (51)32303341