The first thing to notice: "Using temporary"... this is to be avoided, if possible.
## how is the correct way to avoid that? The first table read is klientslowo based on the criteria klientslowo.klientslowo LIKE 'sam%'. Is this a reasonable approach to solving the query, giving your knowledge of the database structure and the data distribution? MySQL estimates that 351 records matches this criteria, is this close to the truth? If not, run ANALYZE TABLE. ## after analyze I saw: Table Op Msg_type Msg_text ikt.klientslowo analyze status Table is already up to date You should not need the DISTINCT keyword. There is no PRIMARY KEY in the branzaslowa table, it seems to have duplicates? ## it shouldn't so I'll try to select without DISTINCT You use a lot of bigint's... an unsigned int is usually sufficient, it consumes half the disc/RAM space... this could be important for the speed of the indexes. Optimally you would want all your indexes to fit in RAM, i.e. the sum of the size of the indexes should be smaller than your index buffer size (key_buffer_size). ## some of tables [like klient, klientslowa, klientulice, klientmiejscowosci etc...] uses in klientid field a numeric value which is 12,14 or 14 characters long so how to correct that? I took a look at the variables from your previous posting. You should increase the key_buffer_size, it is only 8M (default). If you only use MyISAM tables, try setting it to half your total available RAM. This will not affect the speed of the first few queries you run after a restart, but when the caches get "hot" you get very improved speed. ## how to change that from shell? I know Apache a little... regards in advance Darek -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]