View vs. direct Table access

Поиск
Список
Период
Сортировка
От Erwin Ambrosch
Тема View vs. direct Table access
Дата
Msg-id 200203271407.g2RE74g05631@email.ebutec.at
обсуждение исходный текст
Ответы Re: View vs. direct Table access  (Darren Ferguson <darren@crystalballinc.com>)
Re: View vs. direct Table access  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi,

we have a database with about 70 tables. Also we have a View over four tables
which specifies three joins.

Here is the View:

CREATE VIEW company_view AS
SELECT u.id, u.portalident, u.nikname, u.email, u.phone, u.mobile, u.fax,
u.url, a.fname, a.sname, a.street, a.number, a.city, a.zip, co.name_de AS
country, c.name AS cname, c.descr AS philosophy, c.logo_big AS logo,
c.logo_small AS logo_small, c.brancheident
FROM portal_user u, address a, company c, country co
WHERE u.id = a.portal_userid
AND u.id = c.portal_userid
AND a.countryident = co.ident;

While testing with about 10.000 rows in the tables joined by the view, we
noticed that the selects, which use the View as their source, are very slow.
So we did the same queries but accessing the tables directly not via the
view, and the performace increased significantly.

Are Views per default slower than direct table access? And if so is there a
factor for calculationg the performace loss.


Thanks in advance

Erwin


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

Предыдущее
От: "Johann Zuschlag"
Дата:
Сообщение: Re: Trigger does not work as expected
Следующее
От: "Hillensbeck, Preston"
Дата:
Сообщение: Difference between text and char(n)?