LIMIT clause optimization
От | Felipe Schnack |
---|---|
Тема | LIMIT clause optimization |
Дата | |
Msg-id | 1041940047.6599.12.camel@desenv1.ritterdosreis.br обсуждение исходный текст |
Ответы |
Re: LIMIT clause optimization
|
Список | pgsql-general |
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
В списке pgsql-general по дате отправления: