0

I am facing the issue in MySQL as I have created a view, But when I browse; I am getting the below error the row size limit is exceed the threshold.

SQL Error (1118): Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.

Then I have searched and I have got a solution as below
Change limit for "Mysql Row size too large"

The method that worked for the OP there was:

  1. Add the following to the my.cnf file under [mysqld] section.

    innodb_file_per_table
    innodb_file_format = Barracuda
    
  2. ALTER the table to use ROW_FORMAT=COMPRESSED.

    ALTER TABLE nombre_tabla
    ENGINE=InnoDB
    ROW_FORMAT=COMPRESSED 
    KEY_BLOCK_SIZE=8;
    

The problem over here is that I am not able to ALTER the VIEW for ENGINE=InnoDB, ROW_FORMAT=COMPRESSED, KEY_BLOCK_SIZE=8

ALTER VIEW  view_dashboard
ENGINE=InnoDB
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8;  

I am getting the issue for ALTER VIEW as below

SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near       

ENGINE=InnoDB
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8' at line 2 */

/**************************** VIEW DETAILS ******************************************/

CREATE VIEW view_dashboard
AS
SELECT  DISTINCT (ds.ByPatientSessionId) AS ByPatientSessionId,    wd.WardDetailsId AS WardDetailsId, wd.WardLocation As WardLocation, wd.WardDescription AS WardDescription,  
            bd.BedDetailsId AS BedDetailsId,  bd.BedName AS BedName, bd.BedDescription AS BedDescription, bd.ByWardId As ByWardId, 
            pd.PatientDetailsId AS PatientDetailsId, pd.HospitalPatientId As HospitalPatientId, pd.FirstName As FirstName, pd.LastName As LastName, pd.DOB As DOB, pd.AgeBlock As AgeBlock, pd.ByBedId As ByBedId,  
            ps.PatientSessionId, ps.PatientStartSessionTime,  ps.PatientEndSessionByUserId, ps.PatientEndSessionTime, ps.ByPatientId AS ByPatientId, 
            ds.DeviceSessionID AS DeviceSessionID, ds.ByDeviceId AS  DeviceId,   
            di.DeviceInfoId As DeviceInfoId, di.DeviceType As DeviceType, di.HumanReadableDeviceId AS HumanReadableDeviceId ,  
            REPLACE( group_concat( CASE   WHEN ds.DeviceSessionID=  lthr.ByDevSessionId AND  ps.PatientSessionId = ds.ByPatientSessionId  THEN  lthr.HeartRate   ELSE    '' END ),  ',' , '' ) AS LifetouchHeartRate_HeartRate ,  
            REPLACE( group_concat( CASE   WHEN ds.DeviceSessionID=  lthr.ByDevSessionId AND  ps.PatientSessionId = ds.ByPatientSessionId  THEN  lthr.Timestamp ELSE    '' END ),  ',' , '' ) AS LifetouchHeartRate_Timestamp ,  
            lthr.ByDevSessionId AS ByDevSessionId_lthr , 
            REPLACE(  group_concat( CASE   WHEN ds.DeviceSessionID=  ltrr.ByDevSessionId AND  ps.PatientSessionId = ds.ByPatientSessionId  THEN  ltrr.RespirationRate ELSE    '' END ),  ',' , '' ) AS LifetouchRespirationRate_RespirationRate ,  
            REPLACE(  group_concat( CASE   WHEN ds.DeviceSessionID=  ltrr.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  ltrr.Timestamp ELSE    '' END ),  ',' , '' ) AS LifetouchRespirationRate_Timestamp  , 
            ltrr.ByDevSessionId AS ByDevSessionId_ltrr , 
            REPLACE(  group_concat( CASE   WHEN ds.DeviceSessionID=  ltmp.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  ltmp.Temperature ELSE    '' END ),  ',' , '' ) AS   LifeTempTemperature_LifeTempTemperature , 
            REPLACE(  group_concat( CASE   WHEN ds.DeviceSessionID=  ltmp.ByDevSessionId AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  ltmp.Timestamp ELSE    '' END ),  ',' , '' ) AS LifeTempTemperature_Timestamp  , 
            ltmp.ByDevSessionId AS ByDevSessionId_ltmp , 
            REPLACE(  group_concat( CASE   WHEN ds.DeviceSessionID=  bpm.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  bpm.Systolic ELSE    '' END ),  ',' , '' ) AS BloodPressureMeasurement_Systolic  , 
            REPLACE(  group_concat( CASE   WHEN ds.DeviceSessionID=  bpm.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  bpm.Diastolic ELSE    '' END ),  ',' , '' ) AS BloodPressureMeasurement_Diastolic  , 
            REPLACE(  group_concat( CASE   WHEN ds.DeviceSessionID=  bpm.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  bpm.Pulse ELSE    '' END ),  ',' , '' ) AS BloodPressureMeasurement_Pulse  ,  
            REPLACE(  group_concat( CASE   WHEN ds.DeviceSessionID=  bpm.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  bpm.Timestamp  ELSE    '' END ),  ',' , '' ) AS BloodPressureMeasurement_Timestamp  , 
            bpm.ByDevSessionId AS ByDevSessionId_bpm
                  , 
            REPLACE(  group_concat( CASE   WHEN ds.DeviceSessionID=  oxm.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  oxm.SPo2 ELSE    '' END ),  ',' , '' ) AS OximeterMeasurement_SPO2  , 
            REPLACE(  group_concat( CASE   WHEN ds.DeviceSessionID=  oxm.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  oxm.Pulse ELSE    '' END ),  ',' , '' ) AS OximeterMeasurement_Pulse  , 
            REPLACE(  group_concat( CASE   WHEN ds.DeviceSessionID=  oxm.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  oxm.Timestamp ELSE    '' END ),  ',' , '' ) AS OximeterMeasurement_Timestamp  , 
            oxm.ByDevSessionId AS ByDevSessionId_oxm , 
            SUM(  CASE   WHEN ds.DeviceSessionID=  lthr.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  lthr.HeartRate   ELSE    '' END ) AS Heart_Rate  ,  
            SUM( CASE  WHEN ds.DeviceSessionID=  ltrr.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  ltrr.RespirationRate   ELSE    '' END  ) AS Respiration_Rate  , 
            SUM( CASE  WHEN ds.DeviceSessionID=  ltmp.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  ltmp.Temperature ELSE    '' END  ) AS Temperature  ,  
            SUM( CASE  WHEN ds.DeviceSessionID=  bpm.ByDevSessionId AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  bpm.Systolic ELSE '' END  ) AS Systolic  , 
            SUM( CASE  WHEN ds.DeviceSessionID=  bpm.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  bpm.Diastolic ELSE '' END  ) AS Diastolic  , 
            SUM( CASE  WHEN ds.DeviceSessionID=  oxm.ByDevSessionId  AND  ps.PatientSessionId = ds.ByPatientSessionId THEN  oxm.SPo2 ELSE '' END  ) AS SPo2                                                
            FROM  mat.devicesession ds  
            JOIN mat.patientsession ps ON ps.PatientSessionId= ds.ByPatientSessionId 
            JOIN mat.patientdetails pd ON pd.PatientDetailsId= ps.ByPatientId  
            JOIN mat.beddetails bd ON bd.BedDetailsId = pd.ByBedId 
            JOIN mat.warddetails wd ON wd.WardDetailsId = bd.ByWardId 
            JOIN mat.deviceinfo di ON ds.ByDeviceId  = di.DeviceInfoId  
            LEFT JOIN mat.view_lifetouchheartrate lthr ON ds.DeviceSessionID=  lthr.ByDevSessionId 
            LEFT JOIN mat.view_lifetouchrespirationrate ltrr ON ds.DeviceSessionID=  ltrr.ByDevSessionId 
            LEFT JOIN mat.view_lifetemptemperature ltmp ON ds.DeviceSessionID=  ltmp.ByDevSessionId  
            LEFT JOIN mat.view_bloodpressuremeasurement bpm ON ds.DeviceSessionID=  bpm.ByDevSessionId  
            LEFT JOIN mat.oximeterintermediatemeasurement oxm ON ds.DeviceSessionID=  oxm.ByDevSessionId  
            GROUP BY  ds.ByPatientSessionId    
            ORDER BY bd.BedDetailsId
Community
  • 1
  • 1
skt
  • 449
  • 14
  • 32
  • 1
    I've removed the sql-server tag, please don't use tags that aren't relevant to the question. – Tanner Jun 08 '15 at 09:58
  • possible duplicate of [Change limit for "Mysql Row size too large"](http://stackoverflow.com/questions/15585602/change-limit-for-mysql-row-size-too-large) – ceejayoz Jun 08 '15 at 13:04
  • I have tried this link but I am not able to ALTER the VIEW for ROW_FORMAT=COMPRESSED. I am getting SYNTEX error. Not a single post for VIEW for ROW Size on net. – skt Jun 08 '15 at 13:31

0 Answers0