我在MySQL中遇到了这个问题,因为我创建了一个视图,但是当我浏览时;我得到以下错误,行大小限制超过阈值。
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.
然后我搜索了我的解决方案如下 Change limit for "Mysql Row size too large"
适用于OP的方法有:
将以下内容添加到my.cnf
部分下的[mysqld]
文件中。
innodb_file_per_table
innodb_file_format = Barracuda
ALTER
要使用的表格ROW_FORMAT=COMPRESSED
。
ALTER TABLE nombre_tabla
ENGINE=InnoDB
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8;
这里的问题是我无法ALTER
VIEW
ENGINE=InnoDB, ROW_FORMAT=COMPRESSED, KEY_BLOCK_SIZE=8
ALTER VIEW view_dashboard
ENGINE=InnoDB
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8;
我收到ALTER VIEW
的问题,如下所示
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 */
/ ****************************查看详情**************** ********** /
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