[rygel] media-export: Try to prevent full table scan
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] media-export: Try to prevent full table scan
- Date: Sun, 28 Nov 2010 19:38:21 +0000 (UTC)
commit a409ed3b95c89193a0266b29e3600bd9d5943ff1
Author: Jens Georg <mail jensge org>
Date: Sun Nov 28 01:14:03 2010 +0100
media-export: Try to prevent full table scan
.../rygel-media-export-media-cache.vala | 4 ++--
.../rygel-media-export-sql-factory.vala | 7 ++++---
2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-media-cache.vala b/src/plugins/media-export/rygel-media-export-media-cache.vala
index 8b3e063..a101941 100644
--- a/src/plugins/media-export/rygel-media-export-media-cache.vala
+++ b/src/plugins/media-export/rygel-media-export-media-cache.vala
@@ -221,7 +221,7 @@ public class Rygel.MediaExport.MediaCache : Object {
out uint total_matches)
throws Error {
var args = new GLib.ValueArray (0);
- var filter = this.translate_search_expression (expression, args);
+ var filter = this.translate_search_expression (expression, args, "");
if (expression != null) {
debug ("Original search: %s", expression.to_string ());
@@ -249,7 +249,7 @@ public class Rygel.MediaExport.MediaCache : Object {
string container_id)
throws Error {
var args = new GLib.ValueArray (0);
- var filter = this.translate_search_expression (expression, args);
+ var filter = this.translate_search_expression (expression, args, "");
if (expression != null) {
debug ("Original search: %s", expression.to_string ());
diff --git a/src/plugins/media-export/rygel-media-export-sql-factory.vala b/src/plugins/media-export/rygel-media-export-sql-factory.vala
index 72803ed..156b332 100644
--- a/src/plugins/media-export/rygel-media-export-sql-factory.vala
+++ b/src/plugins/media-export/rygel-media-export-sql-factory.vala
@@ -121,9 +121,10 @@ internal class Rygel.MediaExport.SQLFactory : Object {
private const string GET_OBJECTS_BY_FILTER_STRING =
"SELECT DISTINCT " + ALL_DETAILS_STRING +
"FROM Object o " +
- "JOIN Closure c ON o.upnp_id = c.descendant AND c.ancestor = ? " +
"LEFT OUTER JOIN meta_data m " +
- "ON o.upnp_id = m.object_fk %s" +
+ "ON o.upnp_id = m.object_fk " +
+ "WHERE (o.upnp_id IN (" +
+ "SELECT descendant FROM Closure WHERE ancestor = ?)) AND (%s)" +
"ORDER BY o.parent ASC, " +
"o.type_fk ASC, " +
"m.class ASC, " +
@@ -135,7 +136,7 @@ internal class Rygel.MediaExport.SQLFactory : Object {
"SELECT COUNT(o.type_fk) FROM Object o " +
"JOIN Closure c ON o.upnp_id = c.descendant AND c.ancestor = ? " +
"LEFT OUTER JOIN meta_data m " +
- "ON o.upnp_id = m.object_fk %s";
+ "ON o.upnp_id = m.object_fk WHERE %s";
private const string CHILDREN_COUNT_STRING =
"SELECT COUNT(upnp_id) FROM Object WHERE Object.parent = ?";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]