Closed (fixed)
Project:
Radioactivity
Version:
5.x-1.1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Apr 2008 at 21:40 UTC
Updated:
19 May 2008 at 18:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
skiminki commentedIs this required by a real use case? I ask this because inner joins should be faster than left outer joins.
In medium/large sites you can expect 10:1, 100:1 or even greater ratio of nodes per rows in radioactivity (per decay profile) which justifies the inner join. This is the case in a site where this module was originally written for. If you really need left join, I see two possibilities:
We could also make this configurable in the radioactivity admin menu, but I wouldn't want to make this kind of setting global.
Comment #2
guardian commentedmy use case is the following: i have a view that sorts the nodes by radioactivity then by stickiness then by created time
for my home page, i extract the top node of the view and render it highlighted in a separate div so it makes sense to always have a node returned by the view
this enables me to give more importance to the latest sticky node of the site in case of low activity, but as well keep track of the currently most viewed node in case your site has been digged
if you think that performance might be a problem for medium / large sites, i would prefer having an option on the criterium like "All" and "Only Radioactive". having this option means we find a way to change the type of the join dynamically when the view is built. in case we can't do that, having 2 criteria per profile is an acceptable fallback
thx for the follow up ! i'm eager to see this polished :)
Comment #3
skiminki commentedOk, I looked briefly into this, and attached is a patch that provides 'all' and 'radioactive only' versions of field/sort/filter criteria. However, I'm not fully comfortable with this for two reasons:
I'd like to have at least the second item sorted out before inclusion. So, until someone's up to the task...
Comment #4
guardian commentedplease review this one, in the end it seems to work like intended
disclaimer: i have nearly no experience in databases in general but i googled some information about the problem you mentioned regarding PostgreSQL, also this is the first time i'm coding a sort criterion for views
Comment #5
guardian commentedComment #6
guardian commentedworks as intended on mysql, since i don't have postgresql
Comment #7
skiminki commentedOk, I used the patch in comment 4 as a basis and came up with the attached patch. There's some notable changes (in addition to white space changes):
Please, test this patch against the current CVS HEAD ( http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/radioactivi... )
Note that existing views with radioactive energy will get broken after applying this patch.
Comment #8
guardian commentedworks for me
you mentioned "field click sorting uses COALESCE for PostgreSQL compatibility" - i'm not experienced in PostgreSQL at all but the reason why my previous patch uses
$query->orderby[] = "$table.$field IS NOT NULL $order, $table.$field $order";and not COALESCE is that google told me it was a way not to have NULLs at the top of the results when sortingmaybe your implementation of
could as well use
IS NOT NULLinstead ofCOALESCEdepending on the performance ? you decide, as i said i don't know PostgreSQL and can't benchmark it right nowapart from the point mentioned above, ready to be committed ?
Comment #9
skiminki commentedOk, the radioactivity-module-251656-7.patch was almost ready for commit. Two small adjustments:
COALESCEfrom the mysql case. With PostgreSQL we just need to rely on its optimizer for now. AFAICT, we would need to write a real handler to be able to use theIS NOT NULLtrick. Anyway, field click sorting and PostgreSQL combination is not probably that important, even if there was a performance penalty.energy_ftoenergyin 'fields' section. Allows non-hardcoded sort handler.With these two, here's the commit: http://drupal.org/cvs?commit=114748
Thanks!
Comment #10
skiminki commentedComment #11
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.