Supernaw: So the GROUP dont will work

Labrake: SamSagaZ: Your entire question was about t2.

Fventes: SamSagaZ: MAX is only part of the solution. If you need other columns in t2, max will produce a value that can be used in a subsequent join. That’s one of the “groupwise max” solutions.

Taraschke: SamSagaZ: There are at least 10 or more different ways to solve this.

Yahl: If you only needed the date, you would have asked for that. You said you wanted the latest t2 for each t1. That means not just the date/time.

Regehr: I will need all the data from t2 in later queries, i can use group just to display the products names but later need to know the date and stock

Fendrick: Trying with groupwise max

Parr: Hi, what are my option for refering to a row without an id column or a unique index? Do i have to use in my query “where col1 = value and col2 = value . ” ?

Arguilez: Yes. and then think about why primary keys are a good thing and fix your structure.

Stele: Arguilez, it may not be my database but instead it could db ‘mysql’ or ‘information_schema’ whose table rows have no primary keys or even unique indexes so that there is a col to use in my query!

Straughter: Arguilez, thanks for your confirmation anyway :

Waugh: Arguilez, mysql db has PKs sorry, information_schema does not

Kilkus: I have a stroed procedure with a parameter ENUM’0′,’1′

Heesch: I have a weird issue, I set up master-slave replication but now when I change something on the site using the DB it seems to get updated on the slave, but not the master

Kilkus: But if I call the procedure with the parameter set as the int 1, then it doesn’t complain

Tio: Wrksx, enum is “mapped” to int, first item has index 0, second gets 1, so enum’0′, ‘1’ works but enum’1′, ‘0’ reverses everything – not a good idea to use enum with numerical entries imho

Kilkus: Tio, ow ****e I get it now

Kilkus: Tio, i’ll use tinyint and enforce value within the procedure itself then. Thx a lot

Tio: Wrksx, maybe someone asked already. but do you really need to use a stored procedure? in mysql they are not cached well and almost cannot be debugged

Aholt: Wrksx: Yep ENUM is weird and better don’t use it with INTs. Another weirdness is that you can always set it to ” and you certainly don’t want it with 0,1

Arnell: I need help with optimizing my MYSQL DB.

Covarrubias: Here is my sql query http://pastebin.com/bScF7HRa

Vardeman: Here the result of EXPLAIN query http://ctrlv.in/631531

Slaten: Every columns that are joined or in where clause are already indexed , but I still face performance problem.

Macculloch: Describe refppk : http://ctrlv.in/631549

Reineck: Describe datsjp : http://ctrlv.in/631550

Altonen: Describe datnkapst : http://ctrlv.in/631551

Rowlins: My DB contain 1M plus rows. My server specs :

Aholt: Wrksx: Also it is common everywhere in MySQL that 0 is False, and everything 0 is True

Aholt: Curmet: every columns that are joined or in where clause are already indexed sounds bad if you have separate index for each column

Aholt: Curmet: Are you sure about this condition: datsjp.nofpk IS NOT NULL OR datsjp.nofpk ” ? OR?

Kilkus: Tio, I don’t know if I *really* needs it, but it’ll be triggered only once a day and it’s very convenient for me.

Tio: Curmet, do you see that “dependent subquery” row in explain? and 1M rows expected? that means that the subquery is executed more one million times – try to rewrite it as join instead, or make it as fast as possible

Aholt: Curmet: Better rewrite that subquery sas join.

Kilkus: Salle, enum _always_ accepting ” should really be fixed

Kilkus: It seems such a stupid thing I mean

Aholt: Wrksx: ENUM is stupid fullstop :

Aholt: Wrksx: If CHECK CONSTRAINTs were supported you would not need ENUM