Re: sorting query results
От | Piotr Mitoraj |
---|---|
Тема | Re: sorting query results |
Дата | |
Msg-id | 49E9E4F2.10008@gmail.com обсуждение исходный текст |
Ответ на | Re: sorting query results (Brew <brew@theMode.com>) |
Список | pgsql-php |
Piotr...... > >> I recognized two >> ways of doing that: (sorting results) >> >> 1. Issue a new query to the database each time the specific sorting was >> requested. In other words, let the database do the sorting and fetch the >> results. >> >> 2. Save the table into php array and and use php built-in functions to sort >> and refresh the table. >> >> Which of those methods would be most desired in terms of performance and >> according to "the best practices"? >> What would be possible drawbacks/advantages of those methods. >> > > I'd do it in within the database query, it's just a little bit of > programming, probably just add 'ORDER BY' to your statement. Possibly > more, but if you have a real complicated query you'll be spending a > bunch of time getting it right anyway. > > If it's slow, then you start to optimize the query. > > At any rate, that's the way I do it..... > > brew > Thanks Brew! The queries I am using are not that complicated (yet). So for now I ll just stick to this method.
В списке pgsql-php по дате отправления: