当前位置:首页>python>DuckDB + Python 数据科学工作流

DuckDB + Python 数据科学工作流

  • 2026-03-27 22:28:35
DuckDB + Python 数据科学工作流

—— 替代 Pandas 的正确姿势

本文是《DuckDB:从上手到内核》系列的第 3 篇。如果你是 Python 数据工程师,这篇是为你量身写的——DuckDB 怎么跟 Pandas、Polars、Jupyter 配合,以及什么时候该用它替代 Pandas。


Pandas 用了这么多年,为什么要换?

先说清楚:我们不是要"干掉"Pandas,而是在 Pandas 力不从心的地方找帮手。

Pandas 的三个经典痛点:

1.内存杀手:读一个 2GB 的 CSV,Pandas 可能吃掉 6GB 内存(因为类型推断和 object 列的开销)2.大数据 JOIN 慢:两个百万行 DataFrame 做 merge,卡半天3.表达能力受限:窗口函数、复杂子查询——用 Pandas 的链式调用写出来像天书

DuckDB 在这三个场景上都有明显优势。更重要的是,它不需要你放弃 Pandas——两者可以在同一个脚本里无缝配合。


DuckDB Python API 全景

根据 DuckDB Python API 文档[1],核心 API 就这几个:

import duckdb# 1. 连接(默认是内存数据库)con = duckdb.connect()             # 内存数据库con = duckdb.connect('my.duckdb')  # 持久化数据库# 2. 执行查询(两种写法)result = duckdb.sql("SELECT 42")     # 模块级(用全局连接)result = con.sql("SELECT 42")        # 连接级# 3. 获取结果(多种格式)result.show()          # 直接打印表格result.fetchall()      # 返回 Python listresult.df()            # 返回 Pandas DataFrameresult.pl()            # 返回 Polars DataFrameresult.arrow()         # 返回 Arrow Tableresult.fetchnumpy()    # 返回 NumPy 字典# 4. 直接读文件duckdb.read_csv('data.csv')duckdb.read_parquet('data.parquet')duckdb.read_json('data.json')

图 1:DuckDB Python API 数据交互架构

┌───────────────────────────────────────────────────┐│                 你的 Python 脚本                    ││                                                    ││  ┌──────────┐   ┌──────────┐   ┌──────────┐       ││  │  Pandas   │   │  Polars  │   │  Arrow   │       ││  │ DataFrame │   │DataFrame │   │  Table   │       ││  └─────┬────┘   └────┬─────┘   └────┬─────┘       ││        │             │              │              ││        └──────┬──────┘──────────────┘              ││               │ (零拷贝 / 自动检测)                   ││               ▼                                    ││      ┌────────────────┐                            ││      │    DuckDB SQL    │ ←── SQL 查询              ││      │   Engine         │                          ││      └───────┬────────┘                            ││              │                                     ││     ┌────────┼─────────┐                           ││     ▼        ▼         ▼                           ││  .csv     .parquet   .json    ← 直接查文件          │└───────────────────────────────────────────────────┘

几个要点:

duckdb.sql() 返回的是一个 Relation 对象,不是立即执行——它是"懒"的。只有当你调用 .show().df() 等方法时才真正计算。模块级方法(duckdb.sql())用的是一个全局共享连接。如果你在开发库或包,建议用 con = duckdb.connect() 创建独立连接。


核心场景 1:直接查询 Pandas DataFrame

这是 DuckDB 最让人惊喜的能力——Python 变量名就是 SQL 表名

import duckdbimport pandas as pd# 创建两个 DataFrameorders = pd.DataFrame({    'order_id': [1, 2, 3, 4, 5],    'customer_id': [101, 102, 101, 103, 102],    'amount': [250, 130, 80, 420, 310],    'status': ['shipped', 'pending', 'shipped', 'shipped', 'cancelled']})customers = pd.DataFrame({    'id': [101, 102, 103],    'name': ['Alice', 'Bob', 'Charlie'],    'city': ['Beijing', 'Shanghai', 'Shenzhen']})# 直接用 SQL 查询 DataFrame!result = duckdb.sql("""    SELECT c.name, c.city,           COUNT(*) AS order_count,           SUM(o.amount) AS total_spent    FROM orders o    JOIN customers c ON o.customer_id = c.id    WHERE o.status = 'shipped'    GROUP BY c.name, c.city    ORDER BY total_spent DESC""").df()print(result)

输出:

      name      city  order_count  total_spent0  Charlie  Shenzhen            1          4201    Alice   Beijing            2          330

注意:不需要 CREATE TABLE,不需要 register。DuckDB 直接从 Python 的命名空间里找到了 orders 和 customers 这两个变量。

这种"SQL 查 DataFrame"的模式在几个场景下特别有用:

两个 DataFrame 做 JOIN(Pandas 的 merge 语法不直观,尤其是多表 JOIN)复杂的 GROUP BY + 窗口函数(SQL 写起来比 Pandas 链式调用清晰得多)数据清洗中的条件过滤和转换


核心场景 2:大文件处理——Pandas 内存爆了?

问题:你有一个 2GB 的 CSV 文件,Pandas read_csv 直接把内存吃到 8GB,然后 OOM(Out of Memory)。

DuckDB 方案:DuckDB 不需要把整个文件加载到内存。它可以流式处理,内存占用远低于 Pandas。

import duckdbimport time# ---- DuckDB 方式 ----start = time.time()result = duckdb.sql("""    SELECT         DATE_TRUNC('month', event_date::DATE) AS month,        event_type,        COUNT(*) AS event_count,        COUNT(DISTINCT user_id) AS unique_users    FROM 'large_events.csv'    GROUP BY ALL    ORDER BY month, event_count DESC""").df()print(f"DuckDB: {time.time() - start:.2f}s, 结果 {len(result)} 行")# ---- Pandas 方式(对比) ----import pandas as pdstart = time.time()df = pd.read_csv('large_events.csv', parse_dates=['event_date'])result2 = (df.groupby([df.event_date.dt.to_period('M'), 'event_type'])             .agg(event_count=('event_type', 'count'),                  unique_users=('user_id', 'nunique'))             .sort_values(['event_date', 'event_count'], ascending=[True, False])             .reset_index())print(f"Pandas: {time.time() - start:.2f}s, 结果 {len(result2)} 行")

在我的测试环境(M2 MacBook Pro, 16GB RAM, Python 3.11, DuckDB 1.5.0, Pandas 2.2)上,处理一个 1.5GB 的 CSV 文件(约 2000 万行):

指标
DuckDB
Pandas
耗时
2.1s
18.7s
内存峰值
~400MB
~5.2GB
代码行数
9 行 SQL
6 行 Python

DuckDB 快了约 9 倍,内存只用了不到 1/10。 而且 SQL 写法比 Pandas 的链式调用更容易读懂(这个见仁见智,但对复杂逻辑来说 SQL 通常更清晰)。


核心场景 3:窗口函数——Pandas 写不出的分析逻辑

有些分析需求,用 Pandas 写起来极其别扭,但用 SQL 的窗口函数几行就搞定。

需求:计算每个用户的订单金额排名,以及与前一笔订单的时间间隔。

import duckdbresult = duckdb.sql("""    SELECT         user_id,        order_date,        amount,        -- 每个用户内部按金额排名        RANK() OVER (PARTITION BY user_id ORDER BY amount DESC) AS amount_rank,        -- 与该用户上一笔订单的天数间隔        DATEDIFF('day',                 LAG(order_date) OVER (PARTITION BY user_id ORDER BY order_date),                 order_date        ) AS days_since_last_order,        -- 该用户的累计消费        SUM(amount) OVER (PARTITION BY user_id ORDER BY order_date) AS cumulative_spent    FROM 'orders.csv'    ORDER BY user_id, order_date""").df()print(result.head(10))

如果你试过用 Pandas 写这个需求——groupby + rank + shift + cumsum——你就知道 SQL 窗口函数有多香了。


核心场景 4:与 Jupyter Notebook 的集成

在 Jupyter 里用 DuckDB,体验可以非常丝滑:

# Cell 1: 初始化import duckdbcon = duckdb.connect()# Cell 2: 查看数据概览con.sql("""    SELECT * FROM 'sales_data.parquet'     USING SAMPLE 5 ROWS""")# Jupyter 会自动把 Relation 渲染成漂亮的表格# Cell 3: 分析monthly = con.sql("""    SELECT DATE_TRUNC('month', sale_date) AS month,           SUM(revenue) AS total_revenue,           COUNT(DISTINCT customer_id) AS unique_customers    FROM 'sales_data.parquet'    GROUP BY 1    ORDER BY 1""").df()# Cell 4: 可视化(用回 Pandas/Matplotlib)import matplotlib.pyplot as pltmonthly.plot(x='month', y='total_revenue', kind='bar', figsize=(12, 5))plt.title('Monthly Revenue')plt.tight_layout()plt.show()

最佳实践:DuckDB 负责数据处理(查询、聚合、过滤),Pandas + Matplotlib/Plotly 负责可视化。各做各擅长的事。


DuckDB vs Pandas:性能对比实验

我们做一个更系统的对比。测试内容:对不同大小的数据集做 GROUP BY 聚合。

测试环境:M2 MacBook Pro, 16GB RAM, Python 3.11, DuckDB 1.5.0, Pandas 2.2

测试代码(生成测试数据 + 分别用 DuckDB 和 Pandas 聚合):

import duckdbimport pandas as pdimport numpy as npimport timedef benchmark(n_rows):    """生成 n_rows 行数据,对比 DuckDB vs Pandas 的聚合性能"""    # 生成测试数据    np.random.seed(42)    df = pd.DataFrame({        'category': np.random.choice(['A','B','C','D','E'], n_rows),        'region': np.random.choice(['East','West','North','South'], n_rows),        'value': np.random.randn(n_rows) * 100,        'count': np.random.randint(1, 100, n_rows)    })    # DuckDB    start = time.time()    duckdb.sql("""        SELECT category, region,                SUM(value), AVG(value), COUNT(*), MAX(count)        FROM df GROUP BY category, region    """).df()    t_duck = time.time() - start    # Pandas    start = time.time()    df.groupby(['category', 'region']).agg({        'value': ['sum', 'mean', 'count'],        'count': 'max'    }).reset_index()    t_pandas = time.time() - start    return t_duck, t_pandas# 运行测试for n in [100_000, 1_000_000, 10_000_000]:    t_duck, t_pandas = benchmark(n)    speedup = t_pandas / t_duck    print(f"{n:>12,} 行 | DuckDB: {t_duck:.3f}s | Pandas: {t_pandas:.3f}s | 加速比: {speedup:.1f}x")

图 2:DuckDB vs Pandas 聚合性能对比

数据量
DuckDB
Pandas
加速比
100,000 行
0.008s
0.015s
1.9x
1,000,000 行
0.035s
0.120s
3.4x
10,000,000 行
0.280s
1.050s
3.8x

注:以上数据来自我的本地测试(M2 MacBook Pro, 16GB RAM),你的结果可能略有不同。

几个观察:

数据量越大,DuckDB 的优势越明显(列式向量化的红利)在 10 万行以下,两者差距不大——如果你的数据这么小,用啥都行DuckDB 的内存峰值约为 Pandas 的 1/3~1/5(因为不需要把全部数据加载到 Python 对象中)


什么时候用 DuckDB,什么时候留在 Pandas?

场景
推荐
原因
小数据探索(< 10 万行)
Pandas
开销差不多,Pandas API 更熟悉
大文件聚合分析(> 100 万行)
DuckDB
更快,内存更省
多表 JOIN
DuckDB
SQL JOIN 语法比 merge 更直观
窗口函数 / 复杂分析
DuckDB
SQL 表达力更强
数据可视化
Pandas + Matplotlib
DuckDB 没有绘图功能
机器学习特征工程
混合使用
DuckDB 做聚合 → Pandas 做特征
需要修改单元格值
Pandas
DuckDB 查 DataFrame 是只读的
ETL:文件格式转换
DuckDB
COPY TO
 一行搞定

最佳实践:DuckDB 和 Pandas 不是二选一,而是组合使用。 DuckDB 做重活(查询、聚合、JOIN),Pandas 做细活(可视化、特征工程、交互式修改)。


小结

1.DuckDB Python API 很简单duckdb.sql() + .df() 就够应付 80% 的场景2.Python 变量即 SQL 表:直接在 SQL 里查 Pandas/Polars DataFrame3.大文件处理:DuckDB 比 Pandas 快 3–9 倍,内存省 3–5 倍(据我的测试)4.窗口函数是杀手锏:SQL 写复杂分析比 Pandas 链式调用清晰得多5.两者不矛盾:DuckDB 做计算,Pandas 做展示,各司其职

下一篇我们转向原理:DuckDB 的核心架构全景图——它是怎么设计的,一条 SQL 从输入到输出经历了什么。


延伸阅读

DuckDB Python API 文档:https://duckdb.org/docs/api/python/overview[2]DuckDB + Pandas 集成:https://duckdb.org/docs/guides/python/sql_on_pandas[3]DuckDB + Polars:https://duckdb.org/docs/guides/python/polars[4]DuckDB + Jupyter:https://duckdb.org/docs/guides/python/jupyter[5]

References

[1] DuckDB Python API 文档: https://duckdb.org/docs/api/python/overview
[2]https://duckdb.org/docs/api/python/overview
[3]https://duckdb.org/docs/guides/python/sql_on_pandas
[4]https://duckdb.org/docs/guides/python/polars
[5]https://duckdb.org/docs/guides/python/jupyter

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-03-28 04:41:46 HTTP/2.0 GET : https://f.mffb.com.cn/a/483438.html
  2. 运行时间 : 0.096288s [ 吞吐率:10.39req/s ] 内存消耗:5,013.88kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=6fa7f7bc48623c9add52ee348965ab69
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000441s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000640s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.004463s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000343s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000488s ]
  6. SELECT * FROM `set` [ RunTime:0.000219s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000621s ]
  8. SELECT * FROM `article` WHERE `id` = 483438 LIMIT 1 [ RunTime:0.000445s ]
  9. UPDATE `article` SET `lasttime` = 1774644106 WHERE `id` = 483438 [ RunTime:0.007279s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.002809s ]
  11. SELECT * FROM `article` WHERE `id` < 483438 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000447s ]
  12. SELECT * FROM `article` WHERE `id` > 483438 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000385s ]
  13. SELECT * FROM `article` WHERE `id` < 483438 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.003115s ]
  14. SELECT * FROM `article` WHERE `id` < 483438 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.003232s ]
  15. SELECT * FROM `article` WHERE `id` < 483438 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.002564s ]
0.097886s