[ 
https://issues.apache.org/jira/browse/MARMOTTA-175?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13617296#comment-13617296
 ] 

Raffaele Palmieri commented on MARMOTTA-175:
--------------------------------------------

Hi Sebastian, left join/is null is an optimized construct on the major part of 
RDBMS, anyway there is a third possibility with NOT IN clause with this command:
---------------------------------
delete FROM triples WHERE
triples.deleted = true
AND
triples.id not in (SELECT triple_id FROM reasoner_just_supp_triples)
AND
triples.id not in (SELECT triple_id FROM versions_added)
AND
triples.id not in (SELECT triple_id FROM versions_removed)
-----------------------------------

>From some test that I've done on 15K triples, NOT IN is the most efficient 
>query,
following time results in ms
not in=3 
left join=14
not exists=24
 
                
> Garbage collection on triple tables
> -----------------------------------
>
>                 Key: MARMOTTA-175
>                 URL: https://issues.apache.org/jira/browse/MARMOTTA-175
>             Project: Marmotta
>          Issue Type: Bug
>          Components: Triple Store
>    Affects Versions: 3.1-incubating
>         Environment: Centos 6.4 64b - JDK 1.6.0_38 - MySql 5.1.67 -  Tomcat 
> 7.0.37
>            Reporter: Raffaele Palmieri
>            Assignee: Sebastian Schaffert
>            Priority: Minor
>              Labels: garbage, mysql, triplestore
>
> During garbage collection of triple tables in log there is the following line:
> SQL error while executing garbage collection on triples table: You have an 
> error in your SQL syntax; check the manual that corresponds to your MySQL 
> server version for the right syntax to use near 'UNION (SELECT triple_id FROM 
> reasoner_just_supp_triples WHERE triple_id = triple' at line 1

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to