pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedView consistency
6+ messages / 4 participants
[nested] [flat]
* View consistency
@ 2001-11-01 14:20 David M. Richter <d.richter@dkfz.de>
0 siblings, 2 replies; 6+ messages in thread
From: David M. Richter @ 2001-11-01 14:20 UTC (permalink / raw)
To: pgsql-admin@postgresql.org.pgsql-sql
Hello!
Im using several views for the Usermanagment of a database.
My question is:
How does postgres keep the views consistent to the according tables( if
the original table has been changed)?
Is there a Rule? and how is the Rule invoked. With ON DELETE UPDATE
INSERT of the original table?
I didnt found any Rule in pg_rules.
There should be a rule, because I cannot imagine another way wich tells
the view that the table has been changed.
The problem is: If updating the view takes too much time after every
little manipulation, I couldnt use views for usermanagement because of
performance problems.
Any hints and facts?
Thanks in advance
David
Attachments:
d.richter.vcf (text/x-vcard, 497B) download
begin:vcard
url;quoted-printable:http://mbi.DKFZ-Heidelberg.de/=0D=0A
n:M. Richter;David
x-mozilla-html:FALSE
org:Deutsches Krebsforschungszentrum/German Cancer Research Center;Division Medizinische und Biologische Informatik
version:2.1
email;internet:d.richter@dkfz-heidelberg.de
adr;quoted-printable:;;Im Neuenheimer Feld 280 url: http://mbi.DKFZ-Heidelberg.de/=0D=0AD-69120 Heidelberg, Germany ;Heidelberg;Germany;;
x-mozilla-cpt:;-17024
fn:David M. Richter
end:vcard
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: View consistency
@ 2001-11-01 15:48 Tom Lane <tgl@sss.pgh.pa.us>
parent: David M. Richter <d.richter@dkfz.de>
1 sibling, 1 reply; 6+ messages in thread
From: Tom Lane @ 2001-11-01 15:48 UTC (permalink / raw)
To: David M. Richter <d.richter@dkfz.de>; +Cc: pgsql-sql
"David M. Richter" <d.richter@dkfz.de> writes:
> How does postgres keep the views consistent to the according tables( if
> the original table has been changed)?
It doesn't have to; views are not materialized in Postgres. A view
is just a rewrite rule, or macro.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] View consistency
@ 2001-11-01 16:07 Stephan Szabo <sszabo@megazone23.bigpanda.com>
parent: David M. Richter <d.richter@dkfz.de>
1 sibling, 0 replies; 6+ messages in thread
From: Stephan Szabo @ 2001-11-01 16:07 UTC (permalink / raw)
To: David M. Richter <d.richter@dkfz.de>; +Cc: pgsql-admin@postgresql.org; pgsql-sql
On Thu, 1 Nov 2001, David M. Richter wrote:
> Hello!
>
> Im using several views for the Usermanagment of a database.
> My question is:
>
> How does postgres keep the views consistent to the according tables( if
> the original table has been changed)?
AFAIK it's a select rule on the view that rewrites into the view
expression. Nothing keeps it consistent because it's effectively just
a macro for the view expression.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: View consistency
@ 2001-11-01 16:08 David M. Richter <d.richter@dkfz-heidelberg.de>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 6+ messages in thread
From: David M. Richter @ 2001-11-01 16:08 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David M. Richter <d.richter@dkfz-heidelberg.de>; pgsql-sql
Hi,
Thanks, but what I am concerning is the performance.
In my database are some tables bigger than 6 Millions of rows. If one
row has been changed in the normal table,
so the rule will be invoked and the view will be kept in consistance.
But this will take some time, isn't it?
I cannot simulate that case with my database, because Im still
developing.
So i have to know:
Where is the rule or the macro stored? How could I disable it?
Perhaps I could do a reinit of the view not after any Select, but after
any transaction.
But I dont know that rule or macro!
How can I get some information about the rule (wich was automatically
generated by creating the view)?
Thanks for Your hints
DAvid
---------------------------------------------------------------
"David M. Richter" <d.richter@dkfz.de> writes:
> How does postgres keep the views consistent to the according tables( if
> the original table has been changed)?
It doesn't have to; views are not materialized in Postgres. A view
is just a rewrite rule, or macro.
regards, tom lane
Attachments:
d.richter.vcf (text/x-vcard, 497B) download
begin:vcard
url;quoted-printable:http://mbi.DKFZ-Heidelberg.de/=0D=0A
n:M. Richter;David
x-mozilla-html:FALSE
org:Deutsches Krebsforschungszentrum/German Cancer Research Center;Division Medizinische und Biologische Informatik
version:2.1
email;internet:d.richter@dkfz-heidelberg.de
adr;quoted-printable:;;Im Neuenheimer Feld 280 url: http://mbi.DKFZ-Heidelberg.de/=0D=0AD-69120 Heidelberg, Germany ;Heidelberg;Germany;;
x-mozilla-cpt:;-17024
fn:David M. Richter
end:vcard
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: View consistency
@ 2001-11-02 08:45 David M. Richter <d.richter@dkfz-heidelberg.de>
0 siblings, 1 reply; 6+ messages in thread
From: David M. Richter @ 2001-11-02 08:45 UTC (permalink / raw)
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>; Tom Lane <tgl@sss.pgh.pa.us>; pgsql-sql
Hi,
So every time when I 'll use the view, the constraint over the basic
table will be revalidated.
Select name from patient_view;
is in reality:
Select name from (select ...,...,... from basic where xxx=yyy);
Is that right?
DAvid
Attachments:
d.richter.vcf (text/x-vcard, 497B) download
begin:vcard
url;quoted-printable:http://mbi.DKFZ-Heidelberg.de/=0D=0A
n:M. Richter;David
x-mozilla-html:FALSE
org:Deutsches Krebsforschungszentrum/German Cancer Research Center;Division Medizinische und Biologische Informatik
version:2.1
email;internet:d.richter@dkfz-heidelberg.de
adr;quoted-printable:;;Im Neuenheimer Feld 280 url: http://mbi.DKFZ-Heidelberg.de/=0D=0AD-69120 Heidelberg, Germany ;Heidelberg;Germany;;
x-mozilla-cpt:;-17024
fn:David M. Richter
end:vcard
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: View consistency
@ 2001-11-02 15:23 Tom Lane <tgl@sss.pgh.pa.us>
parent: David M. Richter <d.richter@dkfz-heidelberg.de>
0 siblings, 0 replies; 6+ messages in thread
From: Tom Lane @ 2001-11-02 15:23 UTC (permalink / raw)
To: David M. Richter <d.richter@dkfz-heidelberg.de>; +Cc: Stephan Szabo <sszabo@megazone23.bigpanda.com>; pgsql-sql
"David M. Richter" <d.richter@dkfz-heidelberg.de> writes:
> Select name from patient_view;
> is in reality:
> Select name from (select ...,...,... from basic where xxx=yyy);
> Is that right?
Yup. The rule rewriter just substitutes the view definition as a
subselect.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2001-11-02 15:23 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-11-01 14:20 View consistency David M. Richter <d.richter@dkfz.de>
2001-11-01 15:48 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-11-01 16:08 ` David M. Richter <d.richter@dkfz-heidelberg.de>
2001-11-01 16:07 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2001-11-02 08:45 Re: View consistency David M. Richter <d.richter@dkfz-heidelberg.de>
2001-11-02 15:23 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox