Whatever happend to the voting for your favourite local startup
idea? / Startup Tuesday was it?
Sure some variant of that could be made to work & be fun / good
promotion for those startups involved :)
Ok guys, heres something I came across today which I have an idea of what I could do, but im sure theres an easier way..
I have an ActiveRecord class called Releases and one called Albums, im merging to two tables together to a)save space and b)speed up sql called because theres no joins.
Here a show of the releases table (postgres if your interested) showing all with the album_id 46.
I have an Album that has an id 46 and i want to now add the country_id, label_id and realease_date to it, but since theres more than one release row, i need to find a way to condense the array the find the most common values and then save that to the Album table.
Does this seem like a good idea or am I thinking to hard here?
I might be being a bit thick, but I don't get why you're doing this. Albumns
have 1 or more releases, so the 2 tables you have currently makes perfect
sense to me - its exactly how I'd model it. So you want to merge the 2
tables together into one table that has one entry per albumn, but say a
comma-seperated list of releases, is that what you're thinking? Thats going
to make working with the table quite tricky right?
I'm not sure how much space you'd save, I don't see a massive saving here.
And I don't think that performance should be a problem with these 2 tables
either, unless you have some kind of nested iteration through albumns thats
taking ages (and if so can you re-design you're UI to fix this issue?)
Perhaps a de-normalised view over these 2 tables would help you out?
On Wed, Oct 21, 2009 at 2:51 PM, Alex Barlow <alexbarlo...@me.com> wrote:
> Ok guys, heres something I came across today which I have an idea of
> what I could do, but im sure theres an easier way..
> I have an ActiveRecord class called Releases and one called Albums, im
> merging to two tables together to a)save space and b)speed up sql
> called because theres no joins.
> Here a show of the releases table (postgres if your interested)
> showing all with the album_id 46.
> I have an Album that has an id 46 and i want to now add the
> country_id, label_id and realease_date to it, but since theres more
> than one release row, i need to find a way to condense the array the
> find the most common values and then save that to the Album table.
> Does this seem like a good idea or am I thinking to hard here?
Replying to Matt as I don't have the original email.
Just out of interest, how big are the tables, and how much space do they take up? Can you show us an 'explain analyse' of a query that would be optimised by this?
I'd expect that lookups on the tables would all use indexes so like Matt I am struggling to understand exactly how this will help.
Will.
> On Wed, Oct 21, 2009 at 2:51 PM, Alex Barlow <alexbarlo...@me.com> > wrote:
> I have an ActiveRecord class called Releases and one called Albums, im > merging to two tables together to a)save space and b)speed up sql > called because theres no joins.
-- Will Jessop Super Shiny Robot Limited - Professional web design and development
The database as its stands it about 5GB, so a query on tracks was
searching through just over 8 million records, on mysql this took
about 7.5 seconds (without any performance playing) and postgres about
2 seconds.
Im running postgres with keys, indexing and the system also uses
memcache so the calls are down to about 30ms
The problem in trying to crush is for one page the sql looking through
4 tables. I could use ajax of course..
Thinking about it I kind of agree about the 'it should have that'
statement, so ill include that and play about with that.
> Replying to Matt as I don't have the original email.
> Just out of interest, how big are the tables, and how much space do
> they take up? Can you show us an 'explain analyse' of a query that
> would be optimised by this?
> I'd expect that lookups on the tables would all use indexes so like
> Matt I am struggling to understand exactly how this will help.
> Will.
>> On Wed, Oct 21, 2009 at 2:51 PM, Alex Barlow <alexbarlo...@me.com>
>> wrote:
>> I have an ActiveRecord class called Releases and one called Albums,
>> im
>> merging to two tables together to a)save space and b)speed up sql
>> called because theres no joins.
> -- > Will Jessop
> Super Shiny Robot Limited - Professional web design and development