doujie2356 2014-12-04 11:10
浏览 35
已采纳

数据库提取或php生成之间的最佳性能方案是什么

I have a scenario where I just cannot put together which would yield the best performance results. My desire is performance,

I have a few big strings stored in a SQL database

Example:

0,0,0,0,0,0,0,0,0,2,4,4,0,0,0 - This can be (Say 1000 - 20000) characters long(Mostly 0's)

Now I would like to know what will be the best for performance. To keep them in the above format and dong a mysqli fetch or to convert it to something like:

Compressed Example: C0-9,2,4,4,C0-3

Where the number following the - a count. Then to reconvert them before usage. There are mostly huge blocks of 0's so I don't need to worry about condensing other numbers like this.

I know that the second option will have a positive effect on my database sizes. But I am not sure about optimum performance in this case.

  • 写回答

1条回答 默认 最新

  • ds2321 2014-12-04 11:12
    关注

    You can do compression within PHP itself, which would be more efficient than trying it yourself.

    link to gzcompress()

    The basic idea is that you can compress the data when putting it into the database, then decompress it on the way back out. It will improve performance since MySQL will have less memory in use, and function calls are not hugely costly

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数