LIMITing results to max 1, is a good practice when you expect at most 1 result.
On postgresql it is very important to create indexes to have huge performance boosts. Check your slow queries with the EXPLAIN command (see on postgresql.org) and make appropriate indexes. Also do cluster long tables (see the CLUSTER command) and maintain CLUSTERing at regular intervals. After that no other db can beat postgesql, no way ;-) mic 2010/11/18 Chris <partyonais...@gmail.com>: > I added your limitby code to some places. > I haven't seen the same slowdowns recently, though, so it's hard to > tell what happened - maybe it's from a fresh install of postgresql? > We'll see if it comes back. > > On Nov 1, 11:01 pm, KMax <mkostri...@gmail.com> wrote: >> Please check .first() or .last() usage. >> With Postgres for some reason, all data are transfered to DAL, and on >> w2p side first or last recored selected. >> >> Solution also are easy use: >> .select(limitby=(0,1)).first() >> or >> select(limitby=(0,1),orderby=~db.papers.id).first() >> or >> .select(limitby=(0,1),orderby=db.papers.id).first(). >> >> orderby=~ and orderby= will give you last or first for .first() >> and .last() - since only one record are returned from db. >> >> Hope I score. >> >> On 29 ÏËÔ, 12:53, Chris <partyonais...@gmail.com> wrote: >> >> >> >> >> >> >> >> > Hey, >> >> > I've noticed some serious slowdowns ever since I switched from SQLite >> > to Postgres. Pages will take MINUTES to load - it's kind of >> > fascinating. >> >> > I don't have the full explanation for what's going on yet but I do >> > have some clues. I've noticed it happens locally, and in a specific >> > way: >> >> > 1) I load the page up in one browser and it loads and reloads fine. >> > 2) When I open the page up in another browser or in an incognito >> > session on the same machine, the page request hangs, usually for >> > longer than two minutes. >> >> > I don't know for sure that it's Postgres related, but I don't remember >> > seeing this on SQLite. >> >> > This is something I really need to fix! Can anyone reproduce this? Are >> > there profilers or particular places in the code I can tag? >> >> > Thanks! - Chris