Questions tagged [cursor]
A cursor is a control structure for traversing records in a database.
10
questions
2
votes
0
answers
38
views
Cursor-based search result pagination
Can you guys review my GraphQL search pagination function? I'm afraid there could be some performance issues, or something. Especially at the aggregation section and this ...
3
votes
2
answers
672
views
Reading complete contact information in Android
My goal is to read complete contact information on an Android application. This is very slow and my understanding is that since the contacts are stored locally in a phone database, it shouldn't take ...
8
votes
3
answers
4k
views
MySQL-to-PostgreSQL migration script
I'm working on a Python script to migrate a MySQL database into a PostgreSQL database with a different Schema (different table structures, different datatypes and so on).
I'm a sysadmin and ...
3
votes
1
answer
91
views
Is the usage of SQL Cursor appropriate here?
I'm looking for following kind of feedback:
Firstly, is the use of a cursor an overkill here?
Is there a simpler way to do what I'm doing in SQL?
Could the script go terribly wrong?
I have limited ...
3
votes
2
answers
2k
views
SQL cursors and dynamic SQL
The idea is to have a heading for each date returned by the query. This could be any number of dates. I dynamically altered the #table which is ugly but there is no other way.
Ultimately I would ...
7
votes
3
answers
3k
views
SQL Stored Procedure Get Distinct and Update
The idea is to show how many times a user (by EmployeeID) is in the TblTableList and then update the ...
8
votes
3
answers
161
views
Return the top 5 of each kind of record
I have this currently working code, but it's extremely slow. I'm talking almost an hour to execute, if it executes at all (our server isn't all that great to start with). Is there a better way to ...
22
votes
1
answer
420
views
Calculating Lost Reputation
A discussion arose not long ago on the 2nd Monitor about how much reputation has been lost due to the reputation caps. There are a number of queries on the SEDE which try to address this:
A Users ...
3
votes
1
answer
333
views
Simple decorator for creating and managing a database cursor
I'm working on a simple decorator that creates and manages a database cursor. The goal is to 'inject' the cursor as the first argument of the function, but not expose it to the caller.
Usage:
...
3
votes
1
answer
1k
views
DRY cursors: preventing T-SQL's FETCH statement from being repeated
Please assume I've exhaustively tried to come up with a set-based solution to my T-SQL problem, and that I need to use a cursor. The following is the typical1 boilerplate for a T-SQL cursor:
...