Re: Data Warehouse Reevaluation - MySQL vs Postgres -- merge tables
| От | Pierre-Frédéric Caillaud |
|---|---|
| Тема | Re: Data Warehouse Reevaluation - MySQL vs Postgres -- merge tables |
| Дата | |
| Msg-id | opsea7nlytcq72hf@musicbox обсуждение исходный текст |
| Ответ на | Re: Data Warehouse Reevaluation - MySQL vs Postgres -- merge tables (Mark Cotner <mcotner@yahoo.com>) |
| Список | pgsql-performance |
Performance hint :
For static data, do not normalize too much.
For instance if you have a row which can be linked to several other rows,
you can do this :
create table parents (
id serial primary key,
values... )
create table children (
id serial primary key,
parent_id references parents(id),
integer slave_value )
Or you can do this, using an array :
create table everything (
id serial primary key,
integer[] children_values,
values... )
Pros :
No Joins. Getting the list of chilndren_values from table everything is
just a select.
On an application with several million rows, a query lasting 150 ms with
a Join takes 30 ms with an array.
You can build the arrays from normalized tables by using an aggregate
function.
You can index the array elements with a GIST index...
Cons :
No joins, thus your queries are a little bit limited ; problems if the
array is too long ;
В списке pgsql-performance по дате отправления: