Re: Need help with query
От | Joel Burton |
---|---|
Тема | Re: Need help with query |
Дата | |
Msg-id | Pine.LNX.4.21.0104172132480.10991-100000@olympus.scw.org обсуждение исходный текст |
Ответ на | Need help with query (Kevin Heflin <kheflin@shreve.net>) |
Список | pgsql-general |
On Tue, 17 Apr 2001, Kevin Heflin wrote: > Don't know if this would be the correct place to ask this. We have a > postgresql server running version 6.5.3 > It hosts a 100 or so different databases, and performs just great. I do > however have one query which takes about 20 seconds to complete. The > database only has 200-300 records. Don't know much about SQL other than > simple selects and inserts. I'm the one who created the query in > question, and even today when I look at it, I'm not sure I understand > it, but it gives us the results we want, it's just very slow. > > I'm sure someone with some SQL know-how could probably shorten this > query down some. But it's way over my head. > > Basically I've got a database with these tables: > client (list of clients) > project (each project belongs to a client) > subproject (each subproject belongs to a project) > status (each project has a status) > users (each project and subproject are assigned to a user) > timelog (each timelog record indicates time worked on a particular > subproject and who worked on it) > > A sample row would look like this: > > > project_id|project_title|clientid|status|percentcomplete|duedate > |usersid|client_id|name > |users_id|users_name|status_id|status_name|hoursworked > ----------+-------------+--------+------+---------------+----------+-------+ > ---------+-----------+--------+----------+---------+-----------+----------- > 143|project 1 | 79| 3| > 100|04-06-2001| 8| 79|Client Name| 8| Kevin| > 3|status | 1 Kevin -- Looking quickly at your problem, I have one or two ideas, but need to play for a few minutes. Can you post a schema and a small amount of data? -- Joel Burton <jburton@scw.org> Director of Information Systems, Support Center of Washington
В списке pgsql-general по дате отправления: