Hi,

On Feb 6, 2008 6:40 AM, Britske <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm doing some clientside aggregation on rows (which represent prices )
> which sit in a huge table. I therefore want to import these rows in chunks,
> but for this aggregation code to operate correctly I need to be sure that
> all prices of a certain product are contained in the same chunk.
>
> To me it seemd logical to do something like this:
>
> SELECT * FROM prices WHERE prices.productid IN (SELECT id FROM priducts
> ORDER BY id LIMIT 0, 1000)
>
> However, I'm getting an error-message stating that Limit is not allowed in a
> subquery.
> How would you approach this?

I would fetch a list of IDs into the application, then put them into
the IN() list.  IN() subqueries will not perform well even if you
didn't have this LIMIT problem.

Actually, I'd probably use mk-archiver and a plugin to do this,
because it uses a non-backtracking strategy that is very efficient.
http://maatkit.sourceforge.net/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to