Re: Please suggest me on my table design (indexes!)

Поиск
Список
Период
Сортировка
От DaNieL..!
Тема Re: Please suggest me on my table design (indexes!)
Дата
Msg-id fbeef6db-5bcc-4dd0-822d-84a0331c8e49@g1g2000yqh.googlegroups.com
обсуждение исходный текст
Ответ на Please suggest me on my table design (indexes!)  (DaNieL <daniele.pignedoli@gmail.com>)
Ответы Re: Please suggest me on my table design (indexes!)  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Список pgsql-general
The `problem` is that i dont know if having so many indexes will raise
problems as the data dimension grown.

And i am not even sure that this design is truly reliable;
For example, if i would to know how many employees have every company,
i'll have to run that query:
-----
EXPLAIN ANALYZE
SELECT
    c.id,
    c.company_name,
    count(e.id) AS num_employee
FROM
    contact AS c
    LEFT JOIN contact AS e ON (c.id = e.id_company)
WHERE c.tipo = 'company'
GROUP BY c.id, c.company_name
-----

That seem to be not very efficient: http://explain.depesz.com/s/Q0m
(I loaded some test data from http://www.generatedata.com/#generator,
so now i have 23893 rows in the table.. oh, i added a index on the
'kind' (tipo) column too)



On 23 Giu, 13:47, gryz...@gmail.com (Grzegorz Jaśkiewicz) wrote:
> it looks ok on explain, that is - the cost isn't too high.
> So what's the problem ?
>
> --
> Sent via pgsql-general mailing list (pgsql-gene...@postgresql.org)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general


В списке pgsql-general по дате отправления:

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: [BUGS] Integrity check
Следующее
От: Greg Stark
Дата:
Сообщение: Re: Cache lookup failed for type 70385664