MySQL什么更好的速度一个表与百万行或管理多个表? [英] MySQL Whats better for speed one table with millions of rows or managing multiple tables?

查看:133
本文介绍了MySQL什么更好的速度一个表与百万行或管理多个表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用现有的PHP / MySql / JS / Ajax Web应用程序来处理用户的大量表格行。

Im re working an existing PHP/MySql/JS/Ajax web app that processes a LARGE number of table rows for users. Here's how the page works currently.


  1. 用户上传了一个LARGE csv文件。我正在使用的测试一个有400,000行,(每行有5列)。

  2. Php为此数据创建一个全新的表,并插入数十万行。

  3. 然后,该网页以有用的方式将该数据排序/处理/显示回用户。处理包括按照日期和其他行进行搜索,排序,并且在没有大的加载时间(即JS / Ajax进来的地方)的情况下重新显示它们。

我的问题是,这个应用程序应该将数据放入一个新的表中的每一个上传或一个大表与每个文件的ID?我认为原始开发人员添加单独的表为速度的目的。速度对此非常重要。

My question is should this app be placing the data into a new table for each upload or into one large table with an id for each file? I think the origional developer was adding seperate tables for speed purposes. Speed is very important for this.

有更快的方法吗?有更好的鼠标陷阱吗?有没有人曾经用过这个?

Is there a faster way? Is there a better mouse trap? Has anyone ever delt with this?

记住每个.csv可以包含数十万行,每天可以上传数百个.csv文件。虽然他们可以在他们上次使用后24小时删除(我想cron工作任何意见?)

Remember every .csv can contain hundreds of thousands of rows and hundreds of .csv files can be uploaded daily. Though they can be deleted about 24 hrs after they were last used (Im thinking cron job any opinions?)

谢谢大家!

基于评论的几个音符:


  • 所有数据对每个用户都是唯一的,因此用户不会是Re在几个小时后访问此数据。

  • 不需要外键所有csv都是每个用户的私人,不需要交叉引用。

推荐答案

给定10个 5 行和10个 2 每天CSV格式,您每天查看1000万列(您会说您会定期清除这些资料)。这看起来不像一个可怕的数字为一个体面的数据库(特别是考虑到你可以索引表内,而不是多个表)。

Given 105 rows and 102 CSVs per day, you're looking at 10 million rows per day (and you say you'll clear that data down regularly). That doesn't look like a scary figure for a decent db (especially given that you can index within tables, and not across multiple tables).

显然最常用CSV可以很容易地保持在内存中的速度访问 - 或许甚至所有的(一个非常简单的计算基于旁边没有数据给我一个1Gb的数字,如果你每24小时刷新1Gb不是一个不合理的金额记忆这些天)

Obviously the most regularly used CSVs could be very easily held in memory for speed of access - perhaps even all of them (a very simple calculation based on next to no data gives me a figure of 1Gb if you flush every over 24 hours. 1Gb is not an unreasonable amount of memory these days)

这篇关于MySQL什么更好的速度一个表与百万行或管理多个表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆