From: | "Net Virtual Mailing Lists" <mailinglists(at)net-virtual(dot)com> |
---|---|
To: | "Pgsql General" <pgsql-general(at)postgresql(dot)org> |
Subject: | Temporarily disable rule, is this possible? |
Date: | 2004-11-06 16:48:10 |
Message-ID: | 20041106164810.25112@mail.net-virtual.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
I have a table with a rule that goes something like this:
CREATE OR REPLACE RULE sometable_delete ON DELETE DO delete FROM cache
WHERE tablename='sometable';
CREATE OR REPLACE RULE sometable_insert ON INSERT DO delete FROM cache
WHERE tablename='sometable';
CREATE OR REPLACE RULE sometable_update ON UPDATE DO delete FROM cache
WHERE tablename='sometable';
And what I have is set of objects which for certain queries will populate
a serialized variable into the cache table, like this:
INSERT INTO cache (tablename, cache_key, datavalue) VALUES ('sometable',
'some_md5_hash', 'serialized_data');
Using this method it is possible for me to just do a:
SELECT datavalue FROM cache WHERE tablename='sometable' AND
cache_key='some_md5_hash';
.. and if I get an empty value for datavalue then execute the query
normally, process it, then store the serialized data back into the cache...
This all works very well for this situation, it has sped up my
application about 20 times for 95% of the requests....
The problem I have is there are frequently times I need to update
sometable and not have the rule execute, specifically when I am updating
something in the table which does not affect aggregate results.
Is there a way to cause the rules to be temporarily disabled for these
types of queries?
Thanks!
- Greg
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2004-11-06 18:58:19 | Re: superuser equality |
Previous Message | Ed L. | 2004-11-06 16:42:20 | superuser equality |