This paper proposes and tests models that provide quick searching and retrieval of continuations and the longest repeated suffix for data sequences, particularly musical data, using relational databases. The authors extend existing interactive music-generation systems by focusing on large input sequences. Algorithms for indexing prefix trees and factor oracles in relational databases are also proposed. Experiments using textual and musical data provide satisfactory performance results for the models using the two indexing methods.