dsfsw1233 2016-06-13 03:43
浏览 21

加载数千行以在表中呈现给用户的最快方法

Ok, I need to load all rows from a table using SELECT on a certain condition, however the amount of rows that get returned from the query for this table is over 20 thousand and it will grow much larger in the future to well over that, as it's the main table where all the data is stored. I thought about breaking it up some, but I believe it's broken up the best way that it can be broken up currently.

Basically, I need a quick, efficient way to present this data to the client. That is, ALL of the ROWS at once. I am outputting these rows within a table using tr elements, and using wordpress $wpdb like so:

$items = $wpdb->get_results("
    SELECT qvi.ItemName AS name, qvi.TimeAdded AS created, qvi.EffectiveDate AS effective, qvi.VendorName AS supplier, qvi.Source AS source, qvi.Type AS type, qvi.PurchaseCost AS cost, qvi.SalesPrice AS price, IFNULL(qe.CustomerRef_FullName, 'N/A') AS customer, qvi.VendorListID AS vendorListID, qe.CustomerRef_ListID AS customerListID, qvi.ItemListID AS itemListID
    FROM " . $wpdb->prefix . "quickbook_vendor_items AS qvi
    LEFT JOIN " . $wpdb->prefix . "quickbook_estimates AS qe ON (qe.id = qvi.EstimateID)
    WHERE qvi.IsActive = 1 ORDER BY qvi.ItemName ASC", ARRAY_A);

The Main Problem is that it takes about 5 minutes to load all of the data from this table with the above query, and well, I need a better way to do this. Wondering on how others have approached this, that have run into a similar issue with too much data from a query, and how they outputted this data?

Basically, I am open to any ideas that can help make this be a better experience to the client: Partial loading? Loading into a jQuery plugin perhaps? Ajax Loading? Caching the data somehow?

What's the best approach to accomplish this and why?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?
    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
    • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
    • ¥50 需求一个up主付费课程
    • ¥20 模型在y分布之外的数据上预测能力不好如何解决