MySQL Forums
Forum List  »  NDB clusters

Re: Bad performance?
Posted by: Harrison Fisk
Date: December 07, 2004 06:22PM

Jacob Christensen wrote:
> Yes is was a bad select i posted. The select
> allways look like this:
>
> SELECT * FROM cologin WHERE user='XXXX' and
> k_id='XXXX';
>
> Explain from the select above is okay and confirm
> index is okay.
>
> I even tried making a index on all the fields with
> the same result.

You should ideally have an index across both (user, k_id). That will allow it to filter and return only the records in question. After adding the combined index, are you still only getting 5-6 q/s as you indicated in the first post?

>
> This select take 3-4 sec with no load on the
> cluster:
>
> SELECT * FROM cologin LIMIT 350000, 30;
>

Again this query is doing a full table scan. Check EXPLAIN.

If you want to do this in a more optimal way (in a method using indexes), you should look into doing something like:

SELECT * FROM cologin WHERE id > 350000 LIMIT 30;

Keep in mind these queries aren't identical, but might be possible get your application to work with it anyways.


One thing you are missing (from both the first and the second query) is that is the queries *need* to use indexes fully in order to be fast with cluster. Otherwise you end up pulling huge amounts of data across the network since the nodes are seperated.

Harrison Fisk, Trainer and Consultant
MySQL AB, www.mysql.com



Edited 1 time(s). Last edit at 12/07/2004 06:22PM by Harrison Fisk.

Options: ReplyQuote


Subject
Views
Written By
Posted
4093
December 06, 2004 06:33PM
2818
December 06, 2004 09:13PM
2769
December 07, 2004 07:18AM
2587
December 07, 2004 11:58AM
2795
December 07, 2004 01:19PM
Re: Bad performance?
3648
December 07, 2004 06:22PM
2680
December 08, 2004 01:33PM
3560
December 08, 2004 02:44PM
2770
December 09, 2004 10:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.