Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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...@xxxxxxxxx (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...@xxxxxxxxxxxxxx)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux