RE: view query is slow

2012-08-23 Thread Martin Gainty
If memory serves predicates convert strings to column-data-type (in your case DATE) this *should* help WHERE dateexam = STR_TO_DATE('2012-08-13','%Y-%m-%d') does this help? Martin __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de

Re: view query is slow

2012-08-23 Thread Shawn Green
On 8/23/2012 2:30 PM, James W. McNeely wrote: I am working on a view based on this query: === SELECT -- Patient Info p.IdPatient, p.IdLastword MRN, p.NameLast, p.NameFirst, p.Addr1, p.Addr2, p.AddrCity, p.AddrState, p.AddrZip, p.Gender, p.DateOfBirth, --

RE: view query is slow

2012-08-23 Thread Rick James
That is an example of where VIEWs screw up optimizations. Rumor has it that 5.6.6 might have improvements. Probably inefficient: ON CONCAT(e.IdAppt , '0') = c.IdApptType p might benefit from INDEX(AddrState, DateOfBirth) SHOW CREATE TABLE (for each table) EXPLAIN SELECT (with and without

Re: view query is slow

2012-08-23 Thread Sergei Petrunia
On Thu, Aug 23, 2012 at 11:30:17AM -0700, James W. McNeely wrote: I am working on a view based on this query: === SELECT -- Patient Info p.IdPatient, p.IdLastword MRN, p.NameLast, p.NameFirst, p.Addr1, p.Addr2, p.AddrCity, p.AddrState,

Re: view query is slow

2012-08-23 Thread James W. McNeely
Thanks for the responses to everyone! Here is the result for the explains. view query= explain select * from admin_exam_view where dateexam = '2012-08-13';

Re: view query is slow

2012-08-23 Thread James W. McNeely
This didn't help, but good try! Jim McNeely On Aug 23, 2012, at 12:27 PM, Martin Gainty wrote: If memory serves predicates convert strings to column-data-type (in your case DATE) this *should* help WHERE dateexam = STR_TO_DATE('2012-08-13','%Y-%m-%d') does this help? Martin

Re: view query is slow

2012-08-23 Thread James W. McNeely
I think I'll just make a nightly process run that drops and then recreates the table, unless someone has a workable idea of how to make this view query-able. Thanks! Jim McNeely On Aug 23, 2012, at 2:06 PM, James W. McNeely wrote: This didn't help, but good try! Jim McNeely On Aug