Media boards: fishing for opinions
Poll

Which structure would you like best for media albums in Wedge?

ALBUM is a BOARD. Media ITEM is a TOPIC (with its own comments). Album comments are a special topic. Simpler to manage for devs and uploaders, but may slow down some queries.
2 (33.3%)
A unique hidden BOARD contains album topics. ALBUM is an album field (in the album table). Media ITEM is a TOPIC (with its own comments).
0 (0%)
ALBUM is a TOPIC. Media ITEM is a POST in it that contains a media tag and is at the root of the topic. Media item comments are direct replies to the item post. Album comments are replies to the album topic that have no parent and have no media tag.
3 (50%)
A unique hidden BOARD contains album topics. ALBUM is both a TOPIC and an album field (in the album table). Media ITEM is a POST in that topic. The rest is the same as above. (Similar to Aeva Media 2.x)
1 (16.7%)
Something else. Which I'm definitely going to suggest in the comments.
0 (0%)
It's all Chinese to me...
0 (0%)
Total Members Voted: 5

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Media boards: fishing for opinions
« Reply #15, on July 15th, 2012, 07:41 AM »
And benchmarking is something I'm not sure about doing for now... (Well, maybe we can use John's latest plugin for that :P)

I like the idea of a subselect, though, ideally, because it's cleaner and at least it gives MySQL an opportunity to optimize by itself. Only problem is, MySQL is usually not too good at that task... :^^;:

Only one vote in the poll? :sob:
Posted: July 15th, 2012, 07:30 AM

Pete, that reminds me of this post I saw this week...
http://developwithstyle.com/articles/2012/06/22/speeding-up-sql-queries-containing-text-fields/
Do you think that's true? Because if it is, doing MySQL is like fucking voodoo to me :P

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: Media boards: fishing for opinions
« Reply #16, on July 15th, 2012, 07:51 AM »
Quote
And benchmarking is something I'm not sure about doing for now... (Well, maybe we can use John's latest plugin for that :P)
How would that work...? That plugin doesn't benchmark anything...
Quote
Only one vote in the poll? :sob:
I haven't decided whether to vote or A or B. For B, how would viewing albums work?
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Media boards: fishing for opinions
« Reply #17, on July 15th, 2012, 03:48 PM »
Quote
How would that work...? That plugin doesn't benchmark anything...
No, but you get a lot of data to work with to be able to understand how running a larger forum is likely to handle the extra load.
Quote
I haven't decided whether to vote or A or B. For B, how would viewing albums work?
That's a very good question. What it means to me is that MessageIndex.php needs an overhaul, possibly loadBoard() needs to identify the type of board involved and when we would otherwise divert to MessageIndex, we figure out which file needs to be loaded for that type of board.
Quote
Pete, that reminds me of this post I saw this week...
I don't think it's true, I know it is, but I also know the author's an idiot in the first place - SELECT * and SELECT field, table.* levy their own issues, and I suspect something interesting would happen if the author didn't just blindly select * from anywhere.

Anyway, yes, the point is correct: if you do a query where you're sorting by any column and there's a TEXT or larger field in there, it will generate a disk-based temporary table (this is what a filesort is). Getting around it using a subselect is an interesting way of doing it, but essentially yes it's correct, it fools the query parser as to how the table is generated and it means it isn't implicitly a filesort. At that point you just have to hope MySQL can get enough memory to do it in memory otherwise you end up with a filesort anyway.

It's also why Display, for example, gets the message ids first, then fetches messages separately.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Media boards: fishing for opinions
« Reply #18, on July 15th, 2012, 07:25 PM »
Quote from Arantor on July 15th, 2012, 03:48 PM
No, but you get a lot of data to work with to be able to understand how running a larger forum is likely to handle the extra load.
Yep.
Quote
That's a very good question. What it means to me is that MessageIndex.php needs an overhaul, possibly loadBoard() needs to identify the type of board involved and when we would otherwise divert to MessageIndex, we figure out which file needs to be loaded for that type of board.
First, I think that we should build a mini-plugin system for floating boards.
MessageIndex.php would load the main stuff, then would determine the board type and call MessageIndex-Blog.php or whatever. (Or just the corresponding template.)
Same for Display -- Display-Blog.template.php, etc.
This would probably help performance if implementing tons of board types. Also helps with plugins enabling their own board type...?

Now, as for your comment, I'd just like to say that nothing prevents MessageIndex from redirecting to the current code in the /media/ folder. Well, what I really mean is, solution (A) would change the album URLs to use something in the style of board URLs, while solution (B) would keep using ?action=media;sa=album;in=123 where the albums table stores id_album = 123 and id_topic = 345, and id_topic is a custom topic created in a custom (unique) board. The main point is that the code changes are limited, the main drawback is that you can't set up board permissions on the album, rather you have to use the current album permission system -- of course the album permission system is currently better because it offers to ban/allow users on a case by case basis, while boards, and will force you to create a custom group just to allow or deny someone.
I'm not sure what the best would be... Hence my poll.

Heck, the C and D solutions are also complex in that they effectively remove 'albums' from possible 'floating boards', instead having a single hidden board hold all of the albums as topics.

(Of course, I could also have added another suggestion where we have a single hidden board to represent the gallery, and then one topic per item -- with the item/album/category relationship being maintained in the media tables. That would make sense, too...

So, to keep it short, solution A makes the most sense if we want to go fully 'floating boards'. Other solutions might be better for performance. I don't know.
Quote
Anyway, yes, the point is correct: if you do a query where you're sorting by any column and there's a TEXT or larger field in there, it will generate a disk-based temporary table (this is what a filesort is). Getting around it using a subselect is an interesting way of doing it, but essentially yes it's correct, it fools the query parser as to how the table is generated and it means it isn't implicitly a filesort. At that point you just have to hope MySQL can get enough memory to do it in memory otherwise you end up with a filesort anyway.
That's... Very funny.
Well, thankfully, MySQL queries can be optimized later on, they don't have to be static :)