Re: [GENERAL] Embarassing GROUP question

2009-10-03 Thread Sam Mason
On Sat, Oct 03, 2009 at 06:12:20PM -0500, Corey Tisdale wrote: > We also weren't adding image data to blobs, we were bit mapping > faceted data to blob and shifting to allow people to shop by artist or > color or subject matter across millions of posters. Normalized tables > just weren't cutt

Re: [GENERAL] Embarassing GROUP question

2009-10-03 Thread Corey Tisdale
You may have nailed it. Everythig would have been indexed I. The order it was grouped by, so perhaps the order in which things are indexed and accesse is the kicker, or perhaps we've been consistantly lucky. We also weren't adding image data to blobs, we were bit mapping faceted data to blo

Re: [GENERAL] Embarassing GROUP question

2009-10-03 Thread Tom Lane
Corey Tisdale writes: > We're coming from mysql 4, and changing the sort order changes the > values of all columns as you would expect, given that you would expect > a sort statement to affect grouping. This certainly isn't the only > time I've used this syntax. I've been mysql user for ten

Re: [GENERAL] Embarassing GROUP question

2009-10-03 Thread Martin Gainty
anipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > From: co...@eyewantmedia.com > To: t...@sss.pgh.pa.us > Subject: Re: [GENERAL] Embarassing GROUP question > Date: Sat, 3 Oct 2009 16:56:02 -0500 > CC: s...@samason.me.uk; pgsql-general@postgr

Re: [GENERAL] Embarassing GROUP question

2009-10-03 Thread Corey Tisdale
We're coming from mysql 4, and changing the sort order changes the values of all columns as you would expect, given that you would expect a sort statement to affect grouping. This certainly isn't the only time I've used this syntax. I've been mysql user for ten years, and the outcome has b

Re: [GENERAL] Embarassing GROUP question

2009-10-03 Thread Tom Lane
Sam Mason writes: > On Sat, Oct 03, 2009 at 01:05:49PM -0400, Tom Lane wrote: >> but looking at this example, and presuming that you find that >> it actually does something useful, I wonder whether they interpret >> the combination of GROUP BY and ambiguous-per-spec ORDER BY >> in some fashion sim

Re: [GENERAL] Embarassing GROUP question

2009-10-03 Thread Sam Mason
On Sat, Oct 03, 2009 at 01:05:49PM -0400, Tom Lane wrote: > What you might be after is something like Postgres' DISTINCT ON > feature Yup, looks that way to me as well. > I have never really played around with this aspect of MySQL ... Me neither. > but looking at this example, and presuming tha

Re: [GENERAL] Embarassing GROUP question

2009-10-03 Thread Tom Lane
Corey Tisdale writes: > SELECT > meaningful_data, > event_type, > event_date > FROM > event_log > GROUP BY > event_type > ORDER BY > event_date DESC Is event_type a primary key, or at least a candidate key, for this table? (I would guess not based on the name.

[GENERAL] Embarassing GROUP question

2009-10-03 Thread Corey Tisdale
Hi all, I'm a recent MySQL convert, and I am having some difficulty with syntax on grouping a table by a foreign key and returning only the newest entry that matches. In MySQL, you can do something like event_log id event_type event_date meaningful_data SELECT meaning