Remove DISTINCT attribute from views. They are not needed as the corresponding data is obtained from fields with UNIQUE attribute so duplications are already prevented at domain insertion. The elimination of the duplication check on imort through the views slightly reduces the load during import (I observed about 8 percent time saved on my NanoPi NEO).
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
2180531a84
commit
487718512d
|
@ -7,11 +7,11 @@ CREATE TABLE info (property TEXT NOT NULL, value TEXT NOT NULL);
|
|||
|
||||
INSERT INTO info VALUES("version","1");
|
||||
|
||||
CREATE VIEW vw_gravity AS SELECT DISTINCT a.domain
|
||||
CREATE VIEW vw_gravity AS SELECT a.domain
|
||||
FROM gravity a
|
||||
WHERE a.domain NOT IN (SELECT domain from whitelist WHERE enabled == 1);
|
||||
|
||||
CREATE VIEW vw_whitelist AS SELECT DISTINCT a.domain
|
||||
CREATE VIEW vw_whitelist AS SELECT a.domain
|
||||
FROM whitelist a
|
||||
WHERE a.enabled == 1;
|
||||
CREATE TRIGGER tr_whitelist_update AFTER UPDATE ON whitelist
|
||||
|
@ -19,7 +19,7 @@ CREATE TRIGGER tr_whitelist_update AFTER UPDATE ON whitelist
|
|||
UPDATE whitelist SET date_modified = (cast(strftime('%s', 'now') as int)) WHERE domain = NEW.domain;
|
||||
END;
|
||||
|
||||
CREATE VIEW vw_blacklist AS SELECT DISTINCT a.domain
|
||||
CREATE VIEW vw_blacklist AS SELECT a.domain
|
||||
FROM blacklist a
|
||||
WHERE a.enabled == 1 AND a.domain NOT IN vw_whitelist;
|
||||
CREATE TRIGGER tr_blacklist_update AFTER UPDATE ON blacklist
|
||||
|
@ -27,7 +27,7 @@ CREATE TRIGGER tr_blacklist_update AFTER UPDATE ON blacklist
|
|||
UPDATE blacklist SET date_modified = (cast(strftime('%s', 'now') as int)) WHERE domain = NEW.domain;
|
||||
END;
|
||||
|
||||
CREATE VIEW vw_regex AS SELECT DISTINCT a.domain
|
||||
CREATE VIEW vw_regex AS SELECT a.domain
|
||||
FROM regex a
|
||||
WHERE a.enabled == 1;
|
||||
CREATE TRIGGER tr_regex_update AFTER UPDATE ON regex
|
||||
|
@ -35,7 +35,7 @@ CREATE TRIGGER tr_regex_update AFTER UPDATE ON regex
|
|||
UPDATE regex SET date_modified = (cast(strftime('%s', 'now') as int)) WHERE domain = NEW.domain;
|
||||
END;
|
||||
|
||||
CREATE VIEW vw_adlists AS SELECT DISTINCT a.address
|
||||
CREATE VIEW vw_adlists AS SELECT a.address
|
||||
FROM adlists a
|
||||
WHERE a.enabled == 1;
|
||||
CREATE TRIGGER tr_adlists_update AFTER UPDATE ON adlists
|
||||
|
|
Loading…
Reference in New Issue