Results of 1 - 7 of about 7 for counter (0.001 sec.)
- Python Function API 13013
- You can create a DuckDB user-defined function (UDF) from a Python function so it can be used in SQL queries. Similarly to regular functions , they need to have a name, a return type and parameter types. Creating Functions To register a Pyth
...g side_effects . For example, this function will produce a new count for every invocation. def count() -> int: old = count.counter; count.counter += 1 return old count.counter = 0 If we create this function without marking it as having side effects, the...result will be the following: con = duckdb.connect() con.create_function("my_counter", count, side_effects=False) res = con.sql("SELECT my_counter() FROM range(10)").fetchall() print(res) [(0,), (0,), (0,),...bviously not the desired result, when we add side_effects=True , the result is as we would expect: con.remove_function("my_counter") count.counter = 0 con.create_function("my_counter", count, side_effects=True) res = con.sql("SELECT my_counter() FROM ra... - https://man.mtool.work/duckdb/2.0/clients/python/function.html
- WITH Clause 10360
- The WITH clause allows you to specify common table expressions (CTEs). Regular (non-recursive) common-table-expressions are essentially views that are limited in scope to a particular query. CTEs can reference each other and can be nested.
...[1, 5, 8] Accessing the Union Table with recurring Within the recursive term of a WITH RECURSIVE CTE, the CTE name (e.g., counter ) refers to the rows produced by the last iteration . To access all rows accumulated so far (the union table), use the rec...urring schema prefix: WITH RECURSIVE counter(i) AS ( SELECT 1 UNION ALL SELECT i + 1 FROM counter WHERE (SELECT max(i) FROM recurring.counter) < 5 ) SELECT * FROM coun...ter; i 1 2 3 4 5 Here, recurring.counter gives access to all rows accumulated across all previous iterations, while counter in the FROM clause only contains the ro... - https://man.mtool.work/duckdb/2.0/sql/query_syntax/with.html
- My Workload Is Slow 8469
- If you find that your workload in DuckDB is slow, we recommend performing the following checks. More detailed instructions are linked for each point. Do you have enough memory? DuckDB works best if you have 1-4 GB memory per thread . Is you
...g the amount of memory available from the default 80% of the total RAM using SET memory_limit = '...'; . While this sounds counter-intuitive, it can sometimes improve query performance, especially in memory-constrained environments where other processes... - https://man.mtool.work/duckdb/2.0/guides/performance/my_workload_is_slow.html
- Out-of-Memory Issues 8342
- Configuration Options If you are experiencing out-of-memory issues with DuckDB, try tweaking the following configuration options: Reduce the number of threads using the SET threads = ... command. Setting the memory limit lower than the defa
...ult 80% can help prevent out of memory errors. While this configuration sounds counter-intuitive, it helps because some of DuckDB's operations circumvent the database's buffer manager and thus they can reserve... - https://man.mtool.work/duckdb/2.0/guides/performance/oom.html
- Multiple Python Threads 7961
- This page demonstrates how to simultaneously insert into and read from a DuckDB database across multiple Python threads. This could be useful in scenarios where new data is flowing in and an analysis should be periodically re-run. Note that
...ow count thread_name = str(current_thread().name) results = local_con.execute(""" SELECT ? AS thread_name, count(*) AS row_counter, current_localtimestamp() AS read_time FROM my_inserts """, (thread_name,)).fetchall() print(results) Create Threads We de... - https://man.mtool.work/duckdb/2.0/guides/python/multiple_threads.html
- Environment 7833
- The environment where DuckDB is run has an obvious impact on performance. This page focuses on the effects of the hardware configuration and the operating system used. Hardware Configuration CPU DuckDB's officially supported architectures a
...DDs are supported, they will result in low performance, especially for write operations. Disk-based vs. in-memory storage. Counter-intuitively, using a disk-based DuckDB instance can be faster than an in-memory instance. This is because the default sett... - https://man.mtool.work/duckdb/2.0/guides/performance/environment.html
- Tuning Workloads 7579
- DuckDB aims to perform well out of the box, so most workloads do not require any tuning. When tuning is worthwhile, there is no single configuration or magic number that is optimal for every workload: the right settings depend on what you a
...mpression is only applied on persistent (on-disk) databases and not on in-memory tables. In some cases, this can result in counter-intuitive performance results where queries are faster on on-disk tables compared to in-memory ones. Let's take Q1 of the... - https://man.mtool.work/duckdb/2.0/guides/performance/how_to_tune_workloads.html
PREV
1
NEXT
DuckDB 2.0 Documentation / man.mtool.work