]> granicus.if.org Git - postgresql/blob - doc/TODO
1c9798bfb573a506dcd03c7f50fdc29eb1f7cc50
[postgresql] / doc / TODO
1
2 TODO list for PostgreSQL
3 ========================
4 #A hyphen (-) marks changes that will appear in the upcoming 8.1 release.#
5
6 Bracketed items "[]" have more detail.
7
8 Current maintainer:     Bruce Momjian (pgman@candle.pha.pa.us)
9 Last updated:           Wed Nov 10 00:47:03 EST 2004
10
11 The most recent version of this document can be viewed at the PostgreSQL web
12 site, http://www.PostgreSQL.org.
13
14
15
16 Administration
17 ==============
18
19 * Remove behavior of postmaster -o after making postmaster/postgres
20   flags unique
21 * Allow limits on per-db/user connections
22 * Add group object ownership, so groups can rename/drop/grant on objects,
23   so we can implement roles
24 * Allow server log information to be output as INSERT statements
25
26   This would allow server log information to be easily loaded into
27   a database for analysis.
28
29 * Prevent default re-use of sysids for dropped users and groups
30
31   Currently, if a user is removed while he still owns objects, a new
32   user given might be given their user id and inherit the
33   previous users objects.
34
35 * Prevent dropping user that still owns objects, or auto-drop the objects
36 * Allow pooled connections to list all prepared queries
37
38   This would allow an application inheriting a pooled connection to know
39   the queries prepared in the current session.
40
41 * Allow major upgrades without dump/reload, perhaps using pg_upgrade
42 * Have SHOW ALL and pg_settings show descriptions for server-side variables
43 * Allow GRANT/REVOKE permissions to be given to all schema objects with one 
44   command
45 * Remove unreferenced table files created by transactions that were
46   in-progress when the server terminated abruptly
47 * Allow reporting of which objects are in which tablespaces
48
49   This item is difficult because a tablespace can contain objects from
50   multiple databases. There is a server-side function that returns the
51   databases which use a specific tablespace, so this requires a tool
52   that will call that function and connect to each database to find the
53   objects in each database for that tablespace.
54
55 * Allow a database in tablespace t1 with tables created in tablespace t2
56   to be used as a template for a new database created with default
57   tablespace t2
58
59   All objects in the default database tablespace must have default tablespace
60   specifications.  This is because new databases are created by copying 
61   directories.  If you mix default tablespace tables and tablespace-specified
62   tables in the same directory, creating a new database from such a mixed
63   directory would create a new database with tables that had incorrect 
64   explicit tablespaces.  To fix this would require modifying pg_class in the
65   newly copied database, which we don't currently do.
66
67 * Add a GUC variable to control the tablespace for temporary objects and
68   sort files
69
70   It could start with a random tablespace from a supplied list and cycle
71   through the list.
72   
73 * Add "include file" functionality in postgresql.conf
74 * Add session start time and last statement time to pg_stat_activity
75 * Allow server logs to be remotely read using SQL commands
76 * Allow server configuration parameters to be remotely modified
77 * Allow administrators to safely terminate individual sessions
78
79   Right now, SIGTERM will terminate a session, but it is treated as
80   though the postmaster has paniced and shared memory might not be
81   cleaned up properly.  A new signal is needed for safe termination.
82
83 * Un-comment all variables in postgresql.conf
84
85   By not showing commented-out variables, we discourage people from 
86   thinking that re-commenting a variable returns it to its default.
87   This has to address environment variables that are then overridden
88   by config file values.  Another option is to allow commented values
89   to return to their default values.
90
91 * Allow point-in-time recovery to archive partially filled write-ahead 
92   logs
93
94   Currently only full WAL files are archived. This means that the most
95   recent transactions aren't available for recovery in case of a disk
96   failure.
97
98 * Create dump tool for write-ahead logs for use in determining
99   transaction id for point-in-time recovery
100 * Set proper permissions on non-system schemas during db creation
101
102   Currently all schemas are owned by the super-user because they are 
103   copied from the template1 database.
104
105 * Add a function that returns the 'uptime' of the postmaster
106 * Improve replication solutions
107         o Automatic failover
108
109           The proper solution to this will probably the use of a master/slave
110           replication solution like Sloney and a connection pooling tool like
111           pgpool.
112
113         o Load balancing
114
115           You can use any of the master/slave replication servers to use a
116           standby server for data warehousing. To allow read/write queries to
117           multiple servers, you need multi-master replication like pgcluster.
118
119         o Allow replication over unreliable or non-persistent links
120
121
122 Data Types
123 ==========
124
125 * Remove Money type, add money formatting for decimal type
126 * Change NUMERIC to enforce the maximum precision, and increase it
127 * Add function to return compressed length of TOAST data values
128 * Allow INET subnet tests with non-constants to be indexed
129 * Add transaction_timestamp(), statement_timestamp(), clock_timestamp()
130   functionality
131
132   Current CURRENT_TIMESTAMP returns the start time of the current
133   transaction, and gettimeofday() returns the wallclock time. This will
134   make time reporting more consistent and will allow reporting of
135   the statement start time.
136
137 * Have sequence dependency track use of DEFAULT sequences,
138   seqname.nextval (?)
139 * Disallow changing default expression of a SERIAL column (?)
140 * Allow infinite dates just like infinite timestamps
141 * Have initdb set DateStyle based on locale?
142 * Add pg_get_acldef(), pg_get_typedefault(), and pg_get_attrdef()
143 * Allow to_char to print localized month names
144 * Allow functions to have a search path specified at creation time
145 * Allow substring/replace() to get/set bit values
146 * Add GUC variable to allow output of interval values in ISO8601 format
147 * Fix data types where equality comparison isn't intuitive, e.g. box
148 * Merge hardwired timezone names with the TZ database; allow either kind
149   everywhere a TZ name is currently taken
150 * Allow customization of the known set of TZ names (generalize the
151   present australian_timezones hack)
152 * Allow TIMESTAMP WITH TIME ZONE to store the original timezone
153   information, either by name or offset from UTC
154 * Prevent inet cast to cidr if the unmasked bits are not zero, or
155   zero bits
156
157 * ARRAYS
158         o Allow nulls in arrays
159         o Allow MIN()/MAX() on arrays
160         o Delay resolution of array expression type so assignment coercion 
161           can be performed on empty array expressions
162         o Modify array literal representation to handle array index lower bound
163           of other than one
164
165
166 * BINARY DATA
167         o Improve vacuum of large objects, like /contrib/vacuumlo (?)
168         o Add security checking for large objects
169
170           Currently large objects entries do not have owners. Permissions can
171           only be set at the pg_largeobject table level.
172
173         o Auto-delete large objects when referencing row is deleted
174
175         o Allow read/write into TOAST values like large objects
176
177           This requires the TOAST column to be stored EXTERNAL.
178
179
180 Multi-Language Support
181 ======================
182
183 * Add NCHAR (as distinguished from ordinary varchar),
184 * Allow locale to be set at database creation
185
186   Currently locale can only be set during initdb.
187
188 * Allow encoding on a per-column basis
189
190   Right now only one encoding is allowed per database.
191
192 * Optimize locale to have minimal performance impact when not used
193 * Support multiple simultaneous character sets, per SQL92
194 * Improve Unicode combined character handling (?)
195 * Add octet_length_server() and octet_length_client()
196 * Make octet_length_client() the same as octet_length()?
197
198
199 Views / Rules
200 =============
201
202 * Automatically create rules on views so they are updateable, per SQL99
203
204   We can only auto-create rules for simple views.  For more complex
205   cases users will still have to write rules.
206
207 * Add the functionality for WITH CHECK OPTION clause of CREATE VIEW
208 * Allow NOTIFY in rules involving conditionals
209 * Have views on temporary tables exist in the temporary namespace
210 * Allow temporary views on non-temporary tables
211 * Allow RULE recompilation
212
213
214 Indexes
215 =======
216
217 * Allow inherited tables to inherit index, UNIQUE constraint, and primary
218   key, foreign key  [inheritance]
219 * UNIQUE INDEX on base column not honored on inserts/updates from
220   inherited table:  INSERT INTO inherit_table (unique_index_col) VALUES
221   (dup) should fail [inheritance]
222
223   The main difficulty with this item is the problem of creating an index
224   that can span more than one table.
225
226 * Add UNIQUE capability to non-btree indexes
227 * Add rtree index support for line, lseg, path, point
228 * Use indexes for MIN() and MAX()
229
230   MIN/MAX queries can already be rewritten as SELECT col FROM tab ORDER
231   BY col {DESC} LIMIT 1. Completing this item involves making this
232   transformation automatically.
233
234 * Use index to restrict rows returned by multi-key index when used with
235   non-consecutive keys to reduce heap accesses
236
237   For an index on col1,col2,col3, and a WHERE clause of col1 = 5 and
238   col3 = 9, spin though the index checking for col1 and col3 matches,
239   rather than just col1; also called skip-scanning.
240
241 * Prevent index uniqueness checks when UPDATE does not modify the column
242
243   Uniqueness (index) checks are done when updating a column even if the
244   column is not modified by the UPDATE.
245
246 * Fetch heap pages matching index entries in sequential order [performance]
247
248   Rather than randomly accessing heap pages based on index entries, mark
249   heap pages needing access in a bitmap and do the lookups in sequential
250   order. Another method would be to sort heap ctids matching the index
251   before accessing the heap rows.
252
253 * Allow non-bitmap indexes to be combined by creating bitmaps in memory
254
255   Bitmap indexes index single columns that can be combined with other bitmap
256   indexes to dynamically create a composite index to match a specific query.
257   Each index is a bitmap, and the bitmaps are bitwise AND'ed or OR'ed to be
258   combined.  They can index by tid or can be lossy requiring a scan of the
259   heap page to find matching rows, or perhaps use a mixed solution where
260   tids are recorded for pages with only a few matches and per-page bitmaps
261   are used for more dense pages.  Another idea is to use a 32-bit bitmap
262   for every page and set a bit based on the item number mod(32).
263
264 * Allow the creation of on-disk bitmap indexes which can be quickly
265   combined with other bitmap indexes
266
267   Such indexes could be more compact if there are only a few distinct values.
268   Such indexes can also be compressed.  Keeping such indexes updated can be
269   costly.
270
271 * Allow use of indexes to search for NULLs
272
273   One solution is to create a partial index on an IS NULL expression.
274
275 * Add concurrency to GIST
276 * Pack hash index buckets onto disk pages more efficiently
277
278   Currently no only one hash bucket can be stored on a page. Ideally
279   several hash buckets could be stored on a single page and greater
280   granularity used for the hash algorithm.
281
282 * Allow accurate statistics to be collected on indexes with more than
283   one column or expression indexes, perhaps using per-index statistics
284
285 * Add fillfactor to control reserved free space during index creation
286
287 Commands
288 ========
289
290 * Add BETWEEN ASYMMETRIC/SYMMETRIC
291 * Change LIMIT/OFFSET to use int8
292 * Allow CREATE TABLE AS to determine column lengths for complex
293   expressions like SELECT col1 || col2
294 * Allow UPDATE to handle complex aggregates [update] (?)
295 * Allow backslash handling in quoted strings to be disabled for portability
296
297   The use of C-style backslashes (.e.g. \n, \r) in quoted strings is not
298   SQL-spec compliant, so allow such handling to be disabled.
299
300 * Allow an alias to be provided for the target table in UPDATE/DELETE
301
302   This is not SQL-spec but many DBMSs allow it.
303
304 * Allow additional tables to be specified in DELETE for joins
305
306   UPDATE already allows this (UPDATE...FROM) but we need similar
307   functionality in DELETE.  It's been agreed that the keyword should 
308   be USING, to avoid anything as confusing as DELETE FROM a FROM b.
309
310 * Add CORRESPONDING BY to UNION/INTERSECT/EXCEPT
311 * Allow REINDEX to rebuild all database indexes, remove /contrib/reindex
312 * Add ROLLUP, CUBE, GROUPING SETS options to GROUP BY
313 * Add a schema option to createlang
314 * Allow UPDATE tab SET ROW (col, ...) = (...) for updating multiple columns
315 * Allow SET CONSTRAINTS to be qualified by schema/table name
316 * Allow TRUNCATE ... CASCADE/RESTRICT
317 * Allow PREPARE of cursors
318 * Allow PREPARE to automatically determine parameter types based on the SQL 
319   statement
320 * Allow finer control over the caching of prepared query plans
321
322   Currently, queries prepared via the libpq API are planned on first
323   execute using the supplied parameters --- allow SQL PREPARE to do the
324   same.  Also, allow control over replanning prepared queries either
325   manually or automatically when statistics for execute parameters
326   differ dramatically from those used during planning.
327
328 * Allow LISTEN/NOTIFY to store info in memory rather than tables?
329
330   Currently LISTEN/NOTIFY information is stored in pg_listener. Storing
331   such information in memory would improve performance.
332
333 * Dump large object comments in custom dump format
334 * Add optional textual message to NOTIFY
335
336   This would allow an informational message to be added to the notify
337   message, perhaps indicating the row modified or other custom
338   information.
339
340 * Allow CREATE TABLE foo (f1 INT CHECK (f1 > 0) CHECK (f1 < 10)) to work
341   by searching for non-conflicting constraint names, and prefix with
342   table name?
343 * Use more reliable method for CREATE DATABASE to get a consistent copy
344   of db?
345
346   Currently the system uses the operating system COPY command to create
347   new database.
348
349 * Add C code to copy directories for use in creating new databases
350 * Ignore temporary tables from other sessions when processing
351   inheritance?
352 * Have pg_ctl look at PGHOST in case it is a socket directory?
353 * Allow column-level GRANT/REVOKE privileges
354 * Add a session mode to warn about non-standard SQL usage in queries
355 * Add MERGE command that does UPDATE/DELETE, or on failure, INSERT (rules, triggers?)
356 * Add ON COMMIT capability to CREATE TABLE AS SELECT
357 * Add NOVICE output level for helpful messages like automatic sequence/index creation
358 * Add COMMENT ON for all cluster global objects (users, groups,
359   databases and tablespaces)
360 * Add an option to automatically use savepoints for each statement in a
361   multi-statement transaction.
362
363   When enabled, this would allow errors in multi-statement transactions 
364   to be automatically ignored.
365
366 * Make row-wise comparisons work per SQL spec
367 * Add RESET CONNECTION command to reset all session state
368
369   This would include resetting of all variables (RESET ALL), dropping of
370   all temporary tables, removal of any NOTIFYs, etc.  This could be used
371   for connection pooling.  We could also change RESET ALL to have this
372   functionality.
373
374 * ALTER
375         o Have ALTER TABLE RENAME rename SERIAL sequence names
376         o Add ALTER DOMAIN TYPE
377         o Allow ALTER TABLE ... ALTER CONSTRAINT ... RENAME
378         o Allow ALTER TABLE to change constraint deferrability and actions
379         o Disallow dropping of an inherited constraint
380         o Allow objects to be moved to different schemas
381         o Allow ALTER TABLESPACE to move to different directories
382         o Allow databases and schemas to be moved to different tablespaces
383
384           One complexity is whether moving a schema should move all existing
385           schema objects or just define the location for future object creation.
386
387         o Allow moving system tables to other tablespaces, where possible
388
389           Currently non-global system tables must be in the default database
390           schema. Global system tables can never be moved.
391
392
393 * CLUSTER
394         o Automatically maintain clustering on a table
395
396           This might require some background daemon to maintain clustering
397           during periods of low usage. It might also require tables to be only
398           paritally filled for easier reorganization.  Another idea would
399           be to create a merged heap/index data file so an index lookup would
400           automatically access the heap data too.  A third idea would be to
401           store heap rows in hashed groups, perhaps using a user-supplied
402           hash function.
403
404         o Add default clustering to system tables
405
406           To do this, determine the ideal cluster index for each system
407           table and set the cluster setting during initdb.
408
409 * COPY
410         o Allow COPY to report error lines and continue
411         
412           This requires the use of a savepoint before each COPY line is
413           processed, with ROLLBACK on COPY failure.
414
415         o Allow COPY to understand \x as a hex byte
416         o Have COPY return the number of rows loaded/unloaded (?)
417         o Allow COPY to optionally include column headings as the first line
418
419 * CURSOR
420         o Allow UPDATE/DELETE WHERE CURRENT OF cursor
421         
422           This requires using the row ctid to map cursor rows back to the
423           original heap row. This become more complicated if WITH HOLD cursors
424           are to be supported because WITH HOLD cursors have a copy of the row
425           and no FOR UPDATE lock.
426
427         o Prevent DROP TABLE from dropping a row referenced by its own open
428           cursor (?)
429
430         o Allow pooled connections to list all open WITH HOLD cursors
431
432           Because WITH HOLD cursors exist outside transactions, this allows
433           them to be listed so they can be closed.
434
435 * INSERT
436         o Allow INSERT/UPDATE of the system-generated oid value for a row
437         o Allow INSERT INTO tab (col1, ..) VALUES (val1, ..), (val2, ..)
438         o Allow INSERT/UPDATE ... RETURNING new.col or old.col
439         
440           This is useful for returning the auto-generated key for an INSERT.
441           One complication is how to handle rules that run as part of
442           the insert.
443
444 * SHOW/SET
445         o Add SET PERFORMANCE_TIPS option to suggest INDEX, VACUUM, VACUUM
446           ANALYZE, and CLUSTER
447         o Add SET PATH for schemas (?)
448
449           This is basically the same as SET search_path.
450          
451         o Prevent conflicting SET options from being set
452
453           This requires a checking function to be called after the server
454           configuration file is read.
455
456 * SERVER-SIDE LANGUAGES
457         o Allow PL/PgSQL's RAISE function to take expressions (?)
458
459           Currently only constants are supported.
460
461         o Change PL/PgSQL to use palloc() instead of malloc()
462         o Handle references to temporary tables that are created, destroyed, 
463           then recreated during a session, and EXECUTE is not used
464           
465           This requires the cached PL/PgSQL byte code to be invalidated when
466           an object referenced in the function is changed.
467
468         o Fix PL/pgSQL RENAME to work on variables other than OLD/NEW
469         o Improve PL/PgSQL exception handling using savepoints
470         o Allow function parameters to be passed by name,
471           get_employee_salary(emp_id => 12345, tax_year => 2001)
472         o Add Oracle-style packages
473         o Add table function support to pltcl, plperl, plpython (?)
474         o Allow PL/pgSQL to name columns by ordinal position, e.g. rec.(3)
475         o Allow PL/pgSQL EXECUTE query_var INTO record_var;
476         o Add capability to create and call PROCEDURES
477         o Allow PL/pgSQL to handle %TYPE arrays, e.g. tab.col%TYPE[]
478
479
480 Clients
481 =======
482
483 * Add XML output to pg_dump and COPY
484
485   We already allow XML to be stored in the database, and XPath queries
486   can be used on that data using /contrib/xml2. It also supports XSLT
487   transformations.
488     
489 * Add a libpq function to support Parse/DescribeStatement capability
490 * Prevent libpq's PQfnumber() from lowercasing the column name (?)
491 * Allow libpq to access SQLSTATE so pg_ctl can test for connection failure
492
493   This would be used for checking if the server is up.
494
495 * Have psql show current values for a sequence
496 * Move psql backslash database information into the backend, use mnemonic
497   commands? [psql]
498
499   This would allow non-psql clients to pull the same information out of
500   the database as psql.
501
502 * Consistently display privilege information for all objects in psql
503
504 * pg_dump
505         o Have pg_dump use multi-statement transactions for INSERT dumps
506         o Allow pg_dump to use multiple -t and -n switches
507
508           This should be done by allowing a '-t schema.table' syntax.
509
510         o Add dumping of comments on composite type columns
511         o Add dumping of comments on index columns
512         o Replace crude DELETE FROM method of pg_dumpall for cleaning of
513           users and groups with separate DROP commands
514         o Add dumping and restoring of LOB comments
515         o Stop dumping CASCADE on DROP TYPE commands in clean mode
516         o Add full object name to the tag field.  eg. for operators we need
517           '=(integer, integer)', instead of just '='.
518         o Add pg_dumpall custom format dumps. 
519
520           This is probably best done by combining pg_dump and pg_dumpall 
521           into a single binary.
522
523         o Add CSV output format
524
525 * ECPG (?)
526         o Docs
527
528           Document differences between ecpg and the SQL standard and
529           information about the Informix-compatibility module.
530
531         o Solve cardinality > 1 for input descriptors / variables (?)
532         o Improve error handling (?)
533         o Add a semantic check level, e.g. check if a table really exists
534         o fix handling of DB attributes that are arrays
535         o Use backend PREPARE/EXECUTE facility for ecpg where possible
536         o Implement SQLDA
537         o Fix nested C comments
538         o sqlwarn[6] should be 'W' if the PRECISION or SCALE value specified
539         o Make SET CONNECTION thread-aware, non-standard?
540         o Allow multidimensional arrays
541
542
543 Referential Integrity
544 =====================
545
546 * Add MATCH PARTIAL referential integrity
547 * Add deferred trigger queue file
548
549   Right now all deferred trigger information is stored in backend
550   memory.  This could exhaust memory for very large trigger queues.
551   This item involves dumping large queues into files.
552
553 * Implement dirty reads or shared row locks and use them in RI triggers
554
555   Adding shared locks requires recording the table/rows numbers in a 
556   shared area, and this could potentially be a large amount of data.
557   One idea is to store the table/row numbers in a separate table and set
558   a bit on the row indicating looking in this new table is required to
559   find any shared row locks.
560
561 * Enforce referential integrity for system tables
562 * Change foreign key constraint for array -> element to mean element
563   in array (?)
564 * Allow DEFERRABLE UNIQUE constraints (?)
565 * Allow triggers to be disabled [trigger]
566
567   Currently the only way to disable triggers is to modify the system
568   tables.
569
570 * With disabled triggers, allow pg_dump to use ALTER TABLE ADD FOREIGN KEY
571
572   If the dump is known to be valid, allow foreign keys to be added
573   without revalidating the data.
574
575 * Allow statement-level triggers to access modified rows
576 * Support triggers on columns
577 * Remove CREATE CONSTRAINT TRIGGER
578
579   This was used in older releases to dump referential integrity
580   constraints.
581
582 * Allow AFTER triggers on system tables
583
584   System tables are modified in many places in the backend without going
585   through the executor and therefore not causing triggers to fire. To
586   complete this item, the functions that modify system tables will have
587   to fire triggers.
588
589
590 Dependency Checking
591 ===================
592
593 * Flush cached query plans when the dependent objects change
594 * Track dependencies in function bodies and recompile/invalidate
595
596
597 Exotic Features
598 ===============
599
600 * Add SQL99 WITH clause to SELECT
601 * Add SQL99 WITH RECURSIVE to SELECT
602 * Add pre-parsing phase that converts non-ANSI syntax to supported
603   syntax
604
605   This could allow SQL written for other databases to run without
606   modification.
607
608 * Allow plug-in modules to emulate features from other databases
609 * SQL*Net listener that makes PostgreSQL appear as an Oracle database
610   to clients
611 * Allow queries across databases or servers with transaction
612   semantics
613         
614   Right now contrib/dblink can be used to issue such queries except it
615   does not have locking or transaction semantics. Two-phase commit is
616   needed to enable transaction semantics.
617
618 * Add two-phase commit
619
620   This will involve adding a way to respond to commit failure by either
621   taking the server into offline/readonly mode or notifying the
622   administrator
623
624
625 PERFORMANCE
626 ===========
627
628
629 Fsync
630 =====
631
632 * Improve commit_delay handling to reduce fsync()
633 * Determine optimal fdatasync/fsync, O_SYNC/O_DSYNC options
634 * Allow multiple blocks to be written to WAL with one write()
635 * Add an option to sync() before fsync()'ing checkpoint files
636
637
638 Cache
639 =====
640 * Allow free-behind capability for large sequential scans, perhaps using
641   posix_fadvise()
642
643   Posix_fadvise() can control both sequential/random file caching and 
644   free-behind behavior, but it is unclear how the setting affects other
645   backends that also have the file open, and the feature is not supported
646   on all operating systems.
647
648 * Consider use of open/fcntl(O_DIRECT) to minimize OS caching
649 * Cache last known per-tuple offsets to speed long tuple access
650
651   While column offsets are already cached, the cache can not be used if
652   the tuple has NULLs or TOAST columns because these values change the
653   typical column offsets. Caching of such offsets could be accomplished
654   by remembering the previous offsets and use them again if the row has
655   the same pattern.
656
657 * Speed up COUNT(*)
658
659   We could use a fixed row count and a +/- count to follow MVCC
660   visibility rules, or a single cached value could be used and
661   invalidated if anyone modifies the table.
662
663 * Consider automatic caching of queries at various levels:
664         o Parsed query tree
665         o Query execute plan
666         o Query results
667
668
669 Vacuum
670 ======
671
672 * Improve speed with indexes
673
674   For large table adjustements during vacuum, it is faster to reindex
675   rather than update the index.
676
677 * Reduce lock time by moving tuples with read lock, then write
678   lock and truncate table
679
680   Moved tuples are invisible to other backends so they don't require a
681   write lock. However, the read lock promotion to write lock could lead
682   to deadlock situations.
683
684 * Allow free space map to be auto-sized or warn when it is too small
685
686   The free space map is in shared memory so resizing is difficult.
687
688 * Maintain a map of recently-expired rows
689
690   This allows vacuum to reclaim free space without requiring
691   a sequential scan
692
693
694 Locking
695 =======
696
697 * Make locking of shared data structures more fine-grained
698
699   This requires that more locks be acquired but this would reduce lock
700   contention, improving concurrency.
701
702 * Add code to detect an SMP machine and handle spinlocks accordingly
703   from distributted.net, http://www1.distributed.net/source, 
704   in client/common/cpucheck.cpp
705
706   On SMP machines, it is possible that locks might be released shortly,
707   while on non-SMP machines, the backend should sleep so the process
708   holding the lock can complete and release it.
709
710 * Improve SMP performance on i386 machines
711
712   i386-based SMP machines can generate excessive context switching
713   caused by lock failure in high concurrency situations. This may be
714   caused by CPU cache line invalidation inefficiencies.
715
716 * Research use of sched_yield() for spinlock acquisition failure
717
718
719 Startup Time
720 ============
721
722 * Experiment with multi-threaded backend [thread]
723
724   This would prevent the overhead associated with process creation. Most
725   operating systems have trivial process creation time compared to
726   database startup overhead, but a few operating systems (WIn32,
727   Solaris) might benefit from threading.
728
729 * Add connection pooling [pool]
730
731   It is unclear if this should be done inside the backend code or done
732   by something external like pgpool. The passing of file descriptors to
733   existing backends is one of the difficulties with a backend approach.
734
735
736 Write-Ahead Log
737 ===============
738
739 * Eliminate need to write full pages to WAL before page modification [wal]
740
741   Currently, to protect against partial disk page writes, we write the
742   full page images to WAL before they are modified so we can correct any
743   partial page writes during recovery.  These pages can also be
744   eliminated from point-in-time archive files.
745
746 * Reduce WAL traffic so only modified values are written rather than
747   entire rows (?)
748 * Turn off after-change writes if fsync is disabled
749
750   If fsync is off, there is no purpose in writing full pages to WAL
751
752 * Add WAL index reliability improvement to non-btree indexes
753 * Allow the pg_xlog directory location to be specified during initdb
754   with a symlink back to the /data location
755
756 * Allow WAL information to recover corrupted pg_controldata
757 * Find a way to reduce rotational delay when repeatedly writing
758   last WAL page
759   
760   Currently fsync of WAL requires the disk platter to perform a full
761   rotation to fsync again. One idea is to write the WAL to different
762   offsets that might reduce the rotational delay.
763
764 * Allow buffered WAL writes and fsync
765
766   Instead of guaranteeing recovery of all committed transactions, this
767   would provide improved performance by delaying WAL writes and fsync
768   so an abrupt operating system restart might lose a few seconds of 
769   committed transactions but still be consistent.  We could perhaps
770   remove the 'fsync' parameter (which results in an an inconsistent
771   database) in favor of this capability.
772
773
774 Optimizer / Executor
775 ====================
776
777 * Add missing optimizer selectivities for date, r-tree, etc
778 * Allow ORDER BY ... LIMIT 1 to select high/low value without sort or
779   index using a sequential scan for highest/lowest values
780
781   If only one value is needed, there is no need to sort the entire
782   table. Instead a sequential scan could get the matching value.
783
784 * Precompile SQL functions to avoid overhead
785 * Add utility to compute accurate random_page_cost value
786 * Improve ability to display optimizer analysis using OPTIMIZER_DEBUG
787 * Allow sorting, temp files, temp tables to use multiple work directories
788
789   This allows the I/O load to be spread across multiple disk drives.
790 * Have EXPLAIN ANALYZE highlight poor optimizer estimates
791 * Use CHECK constraints to influence optimizer decisions
792
793   CHECK constraints contain information about the distribution of values
794   within the table. This is also useful for implementing subtables where
795   a tables content is distributed across several subtables.
796 * Consider using hash buckets to do DISTINCT, rather than sorting
797
798   This would be beneficial when there are few distinct values.
799
800
801 Miscellaneous
802 =============
803
804 * Do async I/O for faster random read-ahead of data
805
806   Async I/O allows multiple I/O requests to be sent to the disk with
807   results coming back asynchronously.
808     
809 * Use mmap() rather than SYSV shared memory or to write WAL files (?) [mmap]
810
811   This would remove the requirement for SYSV SHM but would introduce
812   portability issues. Anonymous mmap (or mmap to /dev/zero) is required 
813   to prevent I/O overhead.  
814
815 * Consider mmap()'ing files into a backend?
816
817   Doing I/O to large tables would consume a lot of address space or 
818   require frequent mapping/unmapping.  Extending the file also causes 
819   mapping problems that might require mapping only individual pages, 
820   leading to thousands of mappings.  Another problem is that there is no
821   way to _prevent_ I/O to disk from the dirty shared buffers so changes 
822   could hit disk before WAL is written.
823
824 * Add a script to ask system configuration questions and tune postgresql.conf
825 * Use a phantom command counter for nested subtransactions to reduce
826   tuple overhead
827 * Consider parallel processing a single query
828
829   This would involve using multiple threads or processes to do optimization, 
830   sorting, or execution of single query.  The major advantage of such a 
831   feature would be to allow multiple CPUs to work together to process a 
832   single query.
833
834 * Research the use of larger pages sizes
835
836
837 Source Code
838 ===========
839
840 * Add use of 'const' for variables in source tree
841 * Rename some /contrib modules from pg* to pg_*
842 * Move some things from /contrib into main tree
843 * Remove warnings created by -Wcast-align
844 * Move platform-specific ps status display info from ps_status.c to ports
845 * Improve access-permissions check on data directory in Cygwin (Tom)
846 * Add optional CRC checksum to heap and index pages
847 * Clarify use of 'application' and 'command' tags in SGML docs
848 * Better document ability to build only certain interfaces (Marc)
849 * Remove or relicense modules that are not under the BSD license, if possible
850 * Remove memory/file descriptor freeing before ereport(ERROR)
851 * Acquire lock on a relation before building a relcache entry for it
852 * Research interaction of setitimer() and sleep() used by statement_timeout
853 * Rename /scripts directory because they are all C programs now
854 * Promote debug_query_string into a server-side function current_query()
855 * Allow the identifier length to be increased via a configure option
856 * Allow binaries to be statically linked so they are more easily relocated
857 * Move some /contrib modules out to their own project sites
858 * Remove Win32 rename/unlink looping if unnecessary
859 * Remove kerberos4 from source tree?
860
861 * Win32
862         o Remove per-backend parameter file and move into shared memory?
863         o Remove configure.in check for link failure when cause is found
864         o Remove readdir() errno patch when runtime/mingwex/dirent.c rev
865           1.4 is released
866         o Remove psql newline patch when we find out why mingw outputs an
867           extra newline
868         o Allow psql to use readline once non-US code pages work with
869           backslashes
870         o Re-enable timezone output on log_line_prefix '%t' when a
871           shorter timezone string is available
872
873 * Wire Protocol Changes
874         o Allow dynamic character set handling
875         o Add decoded type, length, precision
876         o Use compression?
877         o Update clients to use data types, typmod, schema.table.column names of
878           result sets using new query protocol
879
880
881 ---------------------------------------------------------------------------
882
883
884 Developers who have claimed items are:
885 --------------------------------------
886 * Alvaro is Alvaro Herrera <alvherre@dcc.uchile.cl>
887 * Andrew is Andrew Dunstan <andrew@dunslane.net>
888 * Bruce is Bruce Momjian <pgman@candle.pha.pa.us> of Software Research Assoc.
889 * Christopher is Christopher Kings-Lynne <chriskl@familyhealth.com.au> of
890     Family Health Network
891 * Claudio is Claudio Natoli <claudio.natoli@memetrics.com>
892 * D'Arcy is D'Arcy J.M. Cain <darcy@druid.net> of The Cain Gang Ltd.
893 * Fabien is Fabien Coelho <coelho@cri.ensmp.fr>
894 * Gavin is Gavin Sherry <swm@linuxworld.com.au> of Alcove Systems Engineering
895 * Greg is Greg Sabino Mullane <greg@turnstep.com>
896 * Hiroshi is Hiroshi Inoue <Inoue@tpf.co.jp>
897 * Jan is Jan Wieck <JanWieck@Yahoo.com> of Afilias, Inc.
898 * Joe is Joe Conway <mail@joeconway.com>
899 * Karel is Karel Zak <zakkr@zf.jcu.cz>
900 * Kris is Kris Jurka 
901 * Magnus is Magnus Hagander <mha@sollentuna.net>
902 * Marc is Marc Fournier <scrappy@hub.org> of PostgreSQL, Inc.
903 * Matthew T. O'Connor <matthew@zeut.net>
904 * Michael is Michael Meskes <meskes@postgresql.org> of Credativ
905 * Neil is Neil Conway <neilc@samurai.com>
906 * Oleg is Oleg Bartunov <oleg@sai.msu.su>
907 * Peter is Peter Eisentraut <peter_e@gmx.net>
908 * Philip is Philip Warner <pjw@rhyme.com.au> of Albatross Consulting Pty. Ltd.
909 * Rod is Rod Taylor <pg@rbt.ca>
910 * Simon is Simon Riggs
911 * Stephan is Stephan Szabo <sszabo@megazone23.bigpanda.com>
912 * Tatsuo is Tatsuo Ishii <t-ishii@sra.co.jp> of Software Research Assoc.
913 * Teodor is 
914 * Tom is Tom Lane <tgl@sss.pgh.pa.us> of Red Hat