关于PHP模拟微信朋友圈数据的问题
如A条朋友圈下有N个评论
当用户进入朋友圈刷新最新的10条,如每条朋友圈下都有N个评论那需要调用的数据计算公式为:R = (A*N)*10
我的问题是:这种调取数据的方式,数据库压力很大,需要第一段时间才可以完全调取,但微信朋友圈缺那么快,求大神赐教。
回复讨论(解决方案)
同样用的是数据库,不过不是关系型数据库,而是基于内存的 NOSQL 数据库
关系型数据库是基于硬盘的,速度自然要慢些
所以,速度是钱烧出来的
查询的方法? 依旧是先查询10条朋友圈然后再依次查询出每个朋友圈的评论嘛?
关系型数据库是基于硬盘的,速度自然要慢些
所以,速度是钱烧出来的
查询的方法? 依旧是先查询10条朋友圈然后再依次查询出每个朋友圈的评论嘛?
对!
键值对都是这么查询的
其实要比关联查询慢,只不过载体不同,显得快些罢了
对!
键值对都是这么查询的
其实要比关联查询慢,只不过载体不同,显得快些罢了
谢谢,除了nosql和硬件本身性能提升的办法,还有什么可以在语言本身提升查询速度的方法呢?
没有!
当然前提是数据库给出的提速建议都被你采纳了(或证明无效)
没有!
当然前提是数据库给出的提速建议都被你采纳了(或证明无效)
多谢,大神。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.
