Good morning everyone,
I've got a sql statement that is running quite slow. I've indexed
everything I can that could possibly be applicable but I can't seem to
speed it up.
I've put up the table structures, row counts, the sql statement and
the explain dump of the sql statement all in paste online here
I'm including the sql statement itself here as well:
select distinct products.id as id,
products.created_at as created_at,
products.asin as asin,
products.sales_rank as sales_rank,
products.points as points
inner join (browse_nodes, browse_nodes_to_products) on
(browse_nodes.amazon_id = browse_nodes_to_products.browse_node_id
and products.id = browse_nodes_to_products.product_id)
where browse_nodes.lft >= 5 and browse_nodes.rgt <= 10
order by products.sales_rank desc limit 10 offset 0;
What I'm trying to accomplish with this is to get an ordered list of
unique products found under a category.
Any ideas on how I could speed this up?
Thanks in advance,