拿出独特的针...... [英] fetching unique pins...

查看:52
本文介绍了拿出独特的针......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一张包含一堆预付费密码的表格。什么是在具有大量并发请求的高流量

环境中从表中获取唯一引脚的最佳方法?


例如,我的PIN码表可能如下所示,包含数千张

的记录:


ID PIN ACQUIRED_BY

DATE_ACQUIRED

....

100 1864678198

101 7862517189

102 6356178381

....


10个用户同时请求一个引脚。什么是最简单/最好的方式

,以确保10个用户将获得10个不同的未获取的针脚?


感谢您的帮助...

Hi,

I have a table which contains a bunch of prepaid PINs. What is the
best way to fetch a unique pin from the table in a high-traffic
environment with lots of concurrent requests?

For example, my PINs table might look like this and contain thousands
of records:

ID PIN ACQUIRED_BY
DATE_ACQUIRED
....
100 1864678198
101 7862517189
102 6356178381
....

10 users request a pin at the same time. What is the easiest/best way
to ensure that the 10 users will get 10 different unacquired pins?

Thanks for any help...

推荐答案

Bobus写道:


我有一个包含一个表的表一堆预付费密码。在具有大量并发请求的高流量环境中从表中获取唯一引脚的最佳方法是什么?

例如,我的PIN表可能看起来像这包含数以千计的记录:

ID PIN ACQUIRED_BY
DATE_ACQUIRED
....
100 1864678198
101 7862517189 102 6356178381
....

10个用户同时请求一个引脚。什么是最简单/最好的方法
确保10个用户将获得10个不同的未获取的引脚?
Hi,

I have a table which contains a bunch of prepaid PINs. What is the
best way to fetch a unique pin from the table in a high-traffic
environment with lots of concurrent requests?

For example, my PINs table might look like this and contain thousands
of records:

ID PIN ACQUIRED_BY
DATE_ACQUIRED
....
100 1864678198
101 7862517189
102 6356178381
....

10 users request a pin at the same time. What is the easiest/best way
to ensure that the 10 users will get 10 different unacquired pins?




在PIN上放置主键或唯一约束柱。当发生

重复错误时,会生成新的PIN&尝试再次保存新用户行

。重复直到成功。

-

MGFoster ::: mgf00< at> earthlink< decimal-point> net

奥克兰,加利福尼亚州(美国)



Place a Primary Key or Unique constraint on the PIN column. When a
duplicate error occurs generate a new PIN & try to save the new user row
again. Repeate until success.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)


但是,谢谢,我们不会自己生成个人识别码。我们只是简单地保证从第三方给我们的PIN码库存。


在SQL中有没有办法更新单行ala LIMIT函数在

MYSQL中?类似的东西:

更新tablename set foo = bar limit 1

Thanks, however, we do not generate the PINs ourselves. We simply
maintain the inventory of PINs which are given to us from a 3rd party.

Is there a way in SQL to update a single row ala the LIMIT function in
MYSQL? Something like:
update tablename set foo = bar limit 1


----- BEGIN PGP签名消息--- -

哈希:SHA1


除非您只使用PIN进行一次性操作 - 某处

你要保存该PIN(在表格中)。那个表是你给
放置主键/唯一约束的地方。


我不知道LIMIT函数的功能。如果你想只更新

,你会在WHERE子句中指出哪一行:


UPDATE table_name SET foo = bar WHERE foo_id = 25


foo_id将是一个独特的价值。

-

MGFoster ::: mgf00< at> earthlink< decimal-point> net

奥克兰,加利福尼亚州(美国)


-----开始PGP SIGNATURE -----

版本: PGP个人隐私5.0

Charset:noconv

iQA / AwUBQ / GTdYechKqOuFEgEQLJ / wCgxLHQiPaeDWXwsi5BxBpg6tlKmFoAn0tv

KM3PLa2qdl2KzW3Lp / XFHbiv

= gfzL

-----结束PGP SIGNATURE -----

Bobus写道:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Unless you''re only using the PIN for a one-time operation - somewhere
you are going to save that PIN (in a table). That table is where you''d
put the Primary Key/Unique constraint.

I don''t know what the LIMIT function does. If you want to just update
one row you''d indicate which row in the WHERE clause:

UPDATE table_name SET foo = bar WHERE foo_id = 25

foo_id would be a unique value.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ/GTdYechKqOuFEgEQLJ/wCgxLHQiPaeDWXwsi5BxBpg6tlKmFoAn0tv
KM3PLa2qdl2KzW3Lp/XFHbiv
=gfzL
-----END PGP SIGNATURE-----
Bobus wrote:
谢谢,但是,我们自己不会生成个人识别码。我们只是维护从第三方给我们的PIN库存。

在SQL中有没有办法在
MYSQL中更新LIMIT函数的单行?类似于:
更新tablename set foo = bar limit 1
Thanks, however, we do not generate the PINs ourselves. We simply
maintain the inventory of PINs which are given to us from a 3rd party.

Is there a way in SQL to update a single row ala the LIMIT function in
MYSQL? Something like:
update tablename set foo = bar limit 1



这篇关于拿出独特的针......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆