Re: Optimizing
От | Josh Berkus |
---|---|
Тема | Re: Optimizing |
Дата | |
Msg-id | web-502469@davinci.ethosmedia.com обсуждение исходный текст |
Ответ на | Optimizing ("Jeff Sack" <sackj@alum.rpi.edu>) |
Список | pgsql-sql |
Jeff, > Hello all. I have an academic project that I'm working on and, as > I'm > relatively new to optimization techniques and database design, I'm > wondering if some of you can give me some pointers. See the PostgreSQL book review page: http:\\techdocs.postgresql.org\bookreviews.php There, you will find reviews of several good books on database design. > There are several interesting queries that I've been constructing > just > to get a feel for this schema, and given that some of these tables > contain 100,000-200,000 tuples, some queries are taking a good 5-10 > seconds to execute. I'm just wondering if this is simply the fault > of > my schema or are these queries poorly constructed? That entirely depends. If you're doing this on a 3-year-old laptop, 5-10 seconds is a *good* time. But not on a Proliant 9000. Here's the rules of indexing: 1. All JOIN columns should be indexed. 2. All criteria (WHERE) columns should be indexed, except those that have a very limited range of values (e.g. BOOLEAN). 3. All ORDER BY columns should be indexed, with the same exception. 4. Multi-column indexes are seldom useful for queries. 5. VACUUM should be performed regularly. 6. If SELECT is very fast and INSERT is very slow, try removing a few indexes. Also, you can muck around with runtime settings to you heart's content, and moving the log files (pgsql/data/xlog) to a seperate drive improves performance. There are no quick answers once you've taken the basic steps. -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete informationtechnology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco
В списке pgsql-sql по дате отправления: