Strabon

changeset 298:b7d74d0caa28 noa

add index (subj, obj) on property tables and (value) on datetime_values
author George Garbis <ggarbis@di.uoa.gr>
date Tue Jun 19 15:49:39 2012 +0300 (2012-06-19)
parents e648ef180923
children 16178316aed8
files generaldb/src/main/java/org/openrdf/sail/generaldb/schema/TripleTable.java generaldb/src/main/java/org/openrdf/sail/generaldb/schema/ValueTableFactory.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/TripleTable.java	Mon Jun 18 22:25:06 2012 +0300
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/TripleTable.java	Tue Jun 19 15:49:39 2012 +0300
     1.3 @@ -151,16 +151,47 @@
     1.4  	public void createIndex()
     1.5  		throws SQLException
     1.6  	{
     1.7 +//		if (isPredColumnPresent()) {
     1.8 +//			table.index(PRED_INDEX);
     1.9 +//			total_st++;
    1.10 +//		}
    1.11 +//		table.index(SUBJ_INDEX);
    1.12 +//		total_st++;
    1.13 +//		table.index(CTX_INDEX);
    1.14 +//		total_st++;
    1.15 +//		table.index(EXPL_INDEX);
    1.16 +//		total_st++;
    1.17 +		
    1.18 +		///////
    1.19  		if (isPredColumnPresent()) {
    1.20 -			table.index(PRED_INDEX);
    1.21 +			String[] PRED_OBJ_SUBJ_INDEX = {"pred", "obj", "subj"};
    1.22 +			table.index(PRED_OBJ_SUBJ_INDEX);
    1.23 +			total_st++;
    1.24 +			String[] PRED_SUBJ_OBJ_INDEX = {"pred", "subj", "obj"};
    1.25 +			table.index(PRED_SUBJ_OBJ_INDEX);
    1.26 +			total_st++;
    1.27 +			String[] OBJ_PRED_SUBJ_INDEX = { "obj", "pred", "subj"};
    1.28 +			table.index(OBJ_PRED_SUBJ_INDEX);
    1.29 +			total_st++;
    1.30 +			String[] OBJ_SUBJ_PRED_INDEX = { "obj", "subj", "pred"};
    1.31 +			table.index(OBJ_SUBJ_PRED_INDEX);
    1.32 +			total_st++;
    1.33 +			String[] SUBJ_OBJ_PRED_INDEX = {"subj", "obj", "pred"};
    1.34 +			table.index(SUBJ_OBJ_PRED_INDEX);
    1.35 +			total_st++;
    1.36 +			String[] SUBJ_PRED_OBJ_INDEX = {"subj", "pred", "obj"};
    1.37 +			table.index(SUBJ_PRED_OBJ_INDEX);
    1.38 +			total_st++;
    1.39 +		} else {
    1.40 +//			String[] OBJ_SUBJ_INDEX = {"obj", "subj"};
    1.41 +//			table.index(OBJ_SUBJ_INDEX);
    1.42 +//			total_st++;
    1.43 +			String[] SUBJ_OBJ_INDEX = {"subj", "obj"};
    1.44 +			table.index(SUBJ_OBJ_INDEX);
    1.45  			total_st++;
    1.46  		}
    1.47 -		table.index(SUBJ_INDEX);
    1.48 -		total_st++;
    1.49 -		table.index(CTX_INDEX);
    1.50 -		total_st++;
    1.51 -		table.index(EXPL_INDEX);
    1.52 -		total_st++;
    1.53 +		//////
    1.54 +		
    1.55  	}
    1.56  
    1.57  	public void dropIndex()
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/ValueTableFactory.java	Mon Jun 18 22:25:06 2012 +0300
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/ValueTableFactory.java	Tue Jun 19 15:49:39 2012 +0300
     2.3 @@ -158,6 +158,9 @@
     2.4  		if (!sequenced) {
     2.5  			table.setTemporaryTable(factory.createTemporaryTable(conn, "INSERT_" + name));
     2.6  		}
     2.7 +		if ( name.equals(TIMES) )
     2.8 +			initValueTable(table, queue, sqlType, length, true);
     2.9 +		else
    2.10  		initValueTable(table, queue, sqlType, length, INDEX_VALUES);
    2.11  		return table;
    2.12  	}