0
String s1 = "create table " +tableName+
"(id number NOT NULL PRIMARY KEY, " +
"url varchar(1000) NOT NULL, " +
"urlHash varchar(255) NOT NULL, " +
"contentHash varchar(255), " +
"modDate varchar(30), " +
"contentLocation varchar(100), " +
"status integer, " +
"lastCrawlDate varchar(30)) ";
String s3 = "create sequence " +sequenceName+ " start with 1 increment by 1 nomaxvalue";
stmt=conn.createStatement();
stmt.executeUpdate(s1);
stmt.executeUpdate(s3);
ps = conn.prepareStatement (
"INSERT INTO testing (id, url, urlHash, contentHash, modDate, contentLocation, status, lastCrawlDate) VALUES(test_seq.nextval,?,?,?,?,?,?,?)");
ps.setString (1, url);
ps.setString (2, urlHash);
ps.setString (3, contentHash);
ps.setString (4, modDate);
ps.setString (5, contentLocation);
ps.setLong (6, status);
ps.setString (7, lastCrawlDate);
而我的select查詢將圍繞urlHash和modDate進行。所以,如果我在這些列上創建索引。在Oracle中工作的索引
CREATE INDEX hash_date_idx ON tableName (urlHash asc, modDate asc);
然後,如果我激發基於這兩列或單列的選擇查詢,那麼會在後臺發生什麼。任何人都可以解釋,因爲我是oracle數據庫世界的新手。在這種情況下,什麼樣的指數通常是最好的。在什麼基礎上我們應該使用一個。
Select * from tabelName where urlHash like '%asdreefjhsawofjkwjfkwqdskdjksdwq%';